mastra 0.16.0 → 0.17.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 (324) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/{chunk-GK64AJRT.js → chunk-H4ZSDLAG.js} +443 -412
  3. package/dist/chunk-H4ZSDLAG.js.map +1 -0
  4. package/dist/commands/actions/add-scorer.d.ts +3 -1
  5. package/dist/commands/actions/add-scorer.d.ts.map +1 -1
  6. package/dist/commands/actions/build-project.d.ts +6 -1
  7. package/dist/commands/actions/build-project.d.ts.map +1 -1
  8. package/dist/commands/actions/create-project.d.ts +16 -1
  9. package/dist/commands/actions/create-project.d.ts.map +1 -1
  10. package/dist/commands/actions/init-project.d.ts +13 -1
  11. package/dist/commands/actions/init-project.d.ts.map +1 -1
  12. package/dist/commands/actions/lint-project.d.ts +5 -1
  13. package/dist/commands/actions/lint-project.d.ts.map +1 -1
  14. package/dist/commands/actions/list-scorers.d.ts +1 -1
  15. package/dist/commands/actions/list-scorers.d.ts.map +1 -1
  16. package/dist/commands/actions/start-dev-server.d.ts +13 -1
  17. package/dist/commands/actions/start-dev-server.d.ts.map +1 -1
  18. package/dist/commands/actions/start-project.d.ts +5 -1
  19. package/dist/commands/actions/start-project.d.ts.map +1 -1
  20. package/dist/commands/build/build.d.ts +2 -3
  21. package/dist/commands/build/build.d.ts.map +1 -1
  22. package/dist/commands/create/create.d.ts +2 -1
  23. package/dist/commands/create/create.d.ts.map +1 -1
  24. package/dist/commands/create/create.js +1 -1
  25. package/dist/commands/dev/dev.d.ts +2 -3
  26. package/dist/commands/dev/dev.d.ts.map +1 -1
  27. package/dist/commands/init/init.d.ts +4 -4
  28. package/dist/commands/init/init.d.ts.map +1 -1
  29. package/dist/commands/init/mcp-docs-server-install.d.ts +12 -1
  30. package/dist/commands/init/mcp-docs-server-install.d.ts.map +1 -1
  31. package/dist/commands/init/utils.d.ts +12 -2
  32. package/dist/commands/init/utils.d.ts.map +1 -1
  33. package/dist/commands/utils.d.ts +3 -0
  34. package/dist/commands/utils.d.ts.map +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +26 -80
  37. package/dist/index.js.map +1 -1
  38. package/dist/playground/assets/{abap-DER9Krer.js → abap-VpVyeDq2.js} +1 -1
  39. package/dist/playground/assets/{abnf-DWXViLME.js → abnf-C_FuQNcZ.js} +1 -1
  40. package/dist/playground/assets/{actionscript-CXv95K8S.js → actionscript-C3XhU8Gp.js} +1 -1
  41. package/dist/playground/assets/{ada-CvRLEU5n.js → ada-BpXeRqNm.js} +1 -1
  42. package/dist/playground/assets/{agda-DshgMTT_.js → agda-Drw0hYZY.js} +1 -1
  43. package/dist/playground/assets/{al-ts0JedOv.js → al-o-F6DQ2e.js} +1 -1
  44. package/dist/playground/assets/{antlr4-Yj7kMlPX.js → antlr4-B2IvoZUT.js} +1 -1
  45. package/dist/playground/assets/{apacheconf-BXrDgW-n.js → apacheconf-BgEmCEA3.js} +1 -1
  46. package/dist/playground/assets/{apex-B-gyfGI6.js → apex-VQiddTkC.js} +1 -1
  47. package/dist/playground/assets/{apl-DTPyN0Vq.js → apl-D3J6kgYQ.js} +1 -1
  48. package/dist/playground/assets/{applescript-CYEK0oMG.js → applescript-DXduvKeH.js} +1 -1
  49. package/dist/playground/assets/{aql-DIc6Ndxw.js → aql-CoO8GSHn.js} +1 -1
  50. package/dist/playground/assets/{arduino-BUnHZqtk.js → arduino-Da1MbUvx.js} +1 -1
  51. package/dist/playground/assets/{arff-B7smwONE.js → arff-BqbROG3v.js} +1 -1
  52. package/dist/playground/assets/{asciidoc-yFjHOYf7.js → asciidoc-CDv84C9z.js} +1 -1
  53. package/dist/playground/assets/{asm6502-CCUrnp3e.js → asm6502-CWDcoZv1.js} +1 -1
  54. package/dist/playground/assets/{asmatmel-CgUR3ysa.js → asmatmel-uBGWhhHQ.js} +1 -1
  55. package/dist/playground/assets/{aspnet-D6HP3-lt.js → aspnet-BXeFvXPI.js} +1 -1
  56. package/dist/playground/assets/{autohotkey-vfj1vI9d.js → autohotkey-DfUf08H0.js} +1 -1
  57. package/dist/playground/assets/{autoit-BkdkDe2e.js → autoit-BZrbIvND.js} +1 -1
  58. package/dist/playground/assets/{avisynth-CRCU-miD.js → avisynth-D-LqKSwl.js} +1 -1
  59. package/dist/playground/assets/{avro-idl-BMqeWw25.js → avro-idl-CL-j88oN.js} +1 -1
  60. package/dist/playground/assets/{bash-DtPyBHdr.js → bash-BWZC4Lzf.js} +1 -1
  61. package/dist/playground/assets/{basic-DQyi_gCT.js → basic-Cxoo8EnY.js} +1 -1
  62. package/dist/playground/assets/{batch-1DlOd_jd.js → batch-Hdjmngde.js} +1 -1
  63. package/dist/playground/assets/{bbcode-tV4WMhMm.js → bbcode-D8UCGDsA.js} +1 -1
  64. package/dist/playground/assets/{bicep-ByYbYdxM.js → bicep-zRKsJAnq.js} +1 -1
  65. package/dist/playground/assets/{birb-DvXRTzNc.js → birb-BsLIRsqi.js} +1 -1
  66. package/dist/playground/assets/{bison-DGvHYgCj.js → bison-DegSId9A.js} +1 -1
  67. package/dist/playground/assets/{bnf-s9qJsTwF.js → bnf-CSuqK8NF.js} +1 -1
  68. package/dist/playground/assets/{brainfuck--HljCaVS.js → brainfuck-DCjM32xR.js} +1 -1
  69. package/dist/playground/assets/{brightscript-BqJo_7RX.js → brightscript-CK45j3OY.js} +1 -1
  70. package/dist/playground/assets/{bro-CoTwq4PC.js → bro-CkGLH0tm.js} +1 -1
  71. package/dist/playground/assets/{bsl-CJfJO-32.js → bsl-3FAcHIlr.js} +1 -1
  72. package/dist/playground/assets/{c-B0IiwC88.js → c-BUNdGPuh.js} +1 -1
  73. package/dist/playground/assets/{cfscript-AjlLkkK-.js → cfscript-Dt_xeDLb.js} +1 -1
  74. package/dist/playground/assets/{chaiscript-BLm3tNAA.js → chaiscript-Yc1rKAd2.js} +1 -1
  75. package/dist/playground/assets/{cil-qKCM2p3Z.js → cil-Krjyp-97.js} +1 -1
  76. package/dist/playground/assets/{clike-BrGm5hRf.js → clike-o4HcRp5p.js} +1 -1
  77. package/dist/playground/assets/{clojure-BgGxCRLi.js → clojure-DSr2y_6z.js} +1 -1
  78. package/dist/playground/assets/{cmake-CSYRj77W.js → cmake-CHOaq56P.js} +1 -1
  79. package/dist/playground/assets/{cobol-DH9r5xoC.js → cobol-C0dsrq0_.js} +1 -1
  80. package/dist/playground/assets/{coffeescript-Bxh-CDZ3.js → coffeescript-Cn72KcjR.js} +1 -1
  81. package/dist/playground/assets/{concurnas-Dtz4uupL.js → concurnas-CTfs2m00.js} +1 -1
  82. package/dist/playground/assets/{coq-BxK_6okE.js → coq-Z0C80uzD.js} +1 -1
  83. package/dist/playground/assets/{core-DQm0znEi.js → core-C3gVd0nG.js} +1 -1
  84. package/dist/playground/assets/{cpp-IwmomNZQ.js → cpp-Noek48Ct.js} +1 -1
  85. package/dist/playground/assets/{crystal-F9LTf_-5.js → crystal-C5a6t153.js} +1 -1
  86. package/dist/playground/assets/{csharp-D5AfZ9qQ.js → csharp-JJYMCRkp.js} +1 -1
  87. package/dist/playground/assets/{cshtml-CMOySGU0.js → cshtml-DwnhRUxD.js} +1 -1
  88. package/dist/playground/assets/{csp-C-tALcn0.js → csp-Do_T2Prv.js} +1 -1
  89. package/dist/playground/assets/{css-CQT-6Ykc.js → css-DqEKPO8M.js} +1 -1
  90. package/dist/playground/assets/{css-extras-D7Ty3xA3.js → css-extras-wuG2JGtV.js} +1 -1
  91. package/dist/playground/assets/{csv-52-jJOuj.js → csv-D-IggZSv.js} +1 -1
  92. package/dist/playground/assets/{cypher-CEOI0lcx.js → cypher-DztCFv0p.js} +1 -1
  93. package/dist/playground/assets/{d-DTL0rptQ.js → d-xphkzGQg.js} +1 -1
  94. package/dist/playground/assets/{dart-Rwhy0ouD.js → dart-s364744Q.js} +1 -1
  95. package/dist/playground/assets/{dataweave-DNLojorg.js → dataweave-BrbCqIFp.js} +1 -1
  96. package/dist/playground/assets/{dax-D9W-qLbO.js → dax-lzpGrM2w.js} +1 -1
  97. package/dist/playground/assets/{dhall-sKZPACjI.js → dhall-CwlRR5Qn.js} +1 -1
  98. package/dist/playground/assets/{diff-Cc_zDl81.js → diff-Bz1g1Hqw.js} +1 -1
  99. package/dist/playground/assets/{django-Br-xtCDP.js → django-Cf6DRNlK.js} +1 -1
  100. package/dist/playground/assets/{dns-zone-file-DX043hUy.js → dns-zone-file-DSVcL1MN.js} +1 -1
  101. package/dist/playground/assets/{docker-BWIIKDqy.js → docker-C1mfhGkn.js} +1 -1
  102. package/dist/playground/assets/{dot-De6wLZcl.js → dot-BCX7FdGJ.js} +1 -1
  103. package/dist/playground/assets/{ebnf-Cv95aPQ6.js → ebnf-CAMSMnwD.js} +1 -1
  104. package/dist/playground/assets/{editorconfig-C3g1A9cV.js → editorconfig-DzF_jRd8.js} +1 -1
  105. package/dist/playground/assets/{eiffel-wizmZrk6.js → eiffel-C3nK6tH6.js} +1 -1
  106. package/dist/playground/assets/{ejs-DaOLD0Zl.js → ejs-DKz7xzte.js} +1 -1
  107. package/dist/playground/assets/{elixir-DYNq0vdQ.js → elixir-BoKHRrfK.js} +1 -1
  108. package/dist/playground/assets/{elm-CUZpkzDb.js → elm-X6ikG-bI.js} +1 -1
  109. package/dist/playground/assets/{erb-CQMFkN8D.js → erb-Ocsj3Hfy.js} +1 -1
  110. package/dist/playground/assets/{erlang-C_oVHiu7.js → erlang-CkhdXZRT.js} +1 -1
  111. package/dist/playground/assets/{etlua-Ba8DUapP.js → etlua-DjJI9rJC.js} +1 -1
  112. package/dist/playground/assets/{excel-formula-sHsaAHHh.js → excel-formula-B50gPFGY.js} +1 -1
  113. package/dist/playground/assets/{factor-fydXAdFY.js → factor-BaqMs7OQ.js} +1 -1
  114. package/dist/playground/assets/{false-TLtjiO1e.js → false-CdXzS-Qz.js} +1 -1
  115. package/dist/playground/assets/{firestore-security-rules-CVV8nplj.js → firestore-security-rules-DOQNQupQ.js} +1 -1
  116. package/dist/playground/assets/{flow-C_GkcCzb.js → flow-BI0wecK5.js} +1 -1
  117. package/dist/playground/assets/{fortran-CS52Voge.js → fortran-D8gN_n97.js} +1 -1
  118. package/dist/playground/assets/{fsharp-CKkXOVCf.js → fsharp-CXmYGCVi.js} +1 -1
  119. package/dist/playground/assets/{ftl-B8wKDSUo.js → ftl-DFrWzc2F.js} +1 -1
  120. package/dist/playground/assets/{gap-kNar_59k.js → gap-azXoY9Lo.js} +1 -1
  121. package/dist/playground/assets/{gcode-C3-bP9t0.js → gcode-BvT4fkt9.js} +1 -1
  122. package/dist/playground/assets/{gdscript-BtZjDGBC.js → gdscript-CHDGPiTM.js} +1 -1
  123. package/dist/playground/assets/{gedcom-Cs_FHygB.js → gedcom-DLQR-0eW.js} +1 -1
  124. package/dist/playground/assets/{gherkin-BPJC1ZdU.js → gherkin-Bt7vNS6b.js} +1 -1
  125. package/dist/playground/assets/{git-JiIA-OfQ.js → git-CpearmlZ.js} +1 -1
  126. package/dist/playground/assets/{glsl-CjAxNk2L.js → glsl-BgkyISs7.js} +1 -1
  127. package/dist/playground/assets/{gml-DTXE3c1G.js → gml-DxgB2vDp.js} +1 -1
  128. package/dist/playground/assets/{gn-COv0gu6-.js → gn-0iUnjSCI.js} +1 -1
  129. package/dist/playground/assets/{go-ByE-TECY.js → go-Dnc4kDIH.js} +1 -1
  130. package/dist/playground/assets/{go-module-BFWfj8xV.js → go-module-DJ6_fCKK.js} +1 -1
  131. package/dist/playground/assets/{graphql-B94ebZiX.js → graphql-BKsDns1l.js} +1 -1
  132. package/dist/playground/assets/{groovy-EiUwYQuf.js → groovy-CD4WnZGn.js} +1 -1
  133. package/dist/playground/assets/{haml-DV3xKpN_.js → haml-BaNjNTBj.js} +1 -1
  134. package/dist/playground/assets/{handlebars-CSKvjd6l.js → handlebars-C3EybPaM.js} +1 -1
  135. package/dist/playground/assets/{haskell-Dq9-NfHB.js → haskell-D0MyoDhD.js} +1 -1
  136. package/dist/playground/assets/{haxe-ChCfIxLZ.js → haxe-BLI_YlGX.js} +1 -1
  137. package/dist/playground/assets/{hcl-B4lklXAB.js → hcl-CoXIuAMj.js} +1 -1
  138. package/dist/playground/assets/{hlsl-DXxw6dRR.js → hlsl-DetZFZX2.js} +1 -1
  139. package/dist/playground/assets/{hoon-DJAt9Ux5.js → hoon-C6UQvqzZ.js} +1 -1
  140. package/dist/playground/assets/{hpkp-FDQFkXvd.js → hpkp-DUXfFm2m.js} +1 -1
  141. package/dist/playground/assets/{hsts-Dht1x05j.js → hsts-Cx-0j44D.js} +1 -1
  142. package/dist/playground/assets/{http-BupLwg4p.js → http-D2sC-AVF.js} +1 -1
  143. package/dist/playground/assets/{ichigojam-COgcxPj8.js → ichigojam-CJ7lReO5.js} +1 -1
  144. package/dist/playground/assets/{icon-DG-6ankS.js → icon-DyZSDGk-.js} +1 -1
  145. package/dist/playground/assets/{icu-message-format-BtjxjA3H.js → icu-message-format-DO42ZUvd.js} +1 -1
  146. package/dist/playground/assets/{idris-CYndZ8M7.js → idris-BaZ-ul-C.js} +1 -1
  147. package/dist/playground/assets/{iecst-BvUGBwuj.js → iecst-Bt33Dfnh.js} +1 -1
  148. package/dist/playground/assets/{ignore-BzpXXAL7.js → ignore-BmNbw9yL.js} +1 -1
  149. package/dist/playground/assets/{index-CVIMk5y-.js → index-S2EsucGv.js} +1 -1
  150. package/dist/playground/assets/{index-OHNkwzD-.js → index-am8mDVF2.js} +7 -7
  151. package/dist/playground/assets/{inform7-CQc48l3V.js → inform7-T-PQl4Y8.js} +1 -1
  152. package/dist/playground/assets/{ini-DFAtkHYW.js → ini-BtMKtLvH.js} +1 -1
  153. package/dist/playground/assets/{io-GEZAXfpe.js → io-C6HS03Jb.js} +1 -1
  154. package/dist/playground/assets/{j-Bl2U52bZ.js → j-DlEvz4aw.js} +1 -1
  155. package/dist/playground/assets/{java-DaVqt2KM.js → java-XFYYewkc.js} +1 -1
  156. package/dist/playground/assets/{javadoc-bv9qesqS.js → javadoc-DQbq8V36.js} +1 -1
  157. package/dist/playground/assets/{javadoclike-DO4GBkAK.js → javadoclike-DzpJiZL2.js} +1 -1
  158. package/dist/playground/assets/{javascript-BWKjATU_.js → javascript-CH0KTI-w.js} +1 -1
  159. package/dist/playground/assets/{javastacktrace-CqNvQxD0.js → javastacktrace-D1DWL-6t.js} +1 -1
  160. package/dist/playground/assets/{jexl-iQ9OyqJG.js → jexl-CSrXjxv-.js} +1 -1
  161. package/dist/playground/assets/{jolie-Bqo9Ofi1.js → jolie-B19_-fv1.js} +1 -1
  162. package/dist/playground/assets/{jq-BUD8ONkK.js → jq-Be4VJFlF.js} +1 -1
  163. package/dist/playground/assets/{js-extras-BjfRaycH.js → js-extras-BLHb3hrV.js} +1 -1
  164. package/dist/playground/assets/{js-templates-fXePQZrI.js → js-templates-BrnvK9zU.js} +1 -1
  165. package/dist/playground/assets/{jsdoc-DBU_k4hu.js → jsdoc-DfmI219t.js} +1 -1
  166. package/dist/playground/assets/{json-C6wUC7Qq.js → json-Bjr367_O.js} +1 -1
  167. package/dist/playground/assets/{json5-CNPz8In1.js → json5-CA9o1Faa.js} +1 -1
  168. package/dist/playground/assets/{jsonp-DKrJnAPh.js → jsonp-tCG2DJ5s.js} +1 -1
  169. package/dist/playground/assets/{jsstacktrace-BDszXw4a.js → jsstacktrace-B9rLusxh.js} +1 -1
  170. package/dist/playground/assets/{jsx-Cd00JmdV.js → jsx-DcbmAcIf.js} +1 -1
  171. package/dist/playground/assets/{julia-CyGZbnOv.js → julia-DHJm07ZK.js} +1 -1
  172. package/dist/playground/assets/{keepalived-gdLKiVne.js → keepalived-DEq18gvv.js} +1 -1
  173. package/dist/playground/assets/{keyman-Cl_ED8Ox.js → keyman-dsql1r0j.js} +1 -1
  174. package/dist/playground/assets/{kotlin-DCh9G12v.js → kotlin-DPjqobbb.js} +1 -1
  175. package/dist/playground/assets/{kumir-B-9YWSYm.js → kumir-BzLiNniZ.js} +1 -1
  176. package/dist/playground/assets/{kusto-C-45iPx_.js → kusto-BgKl4nLI.js} +1 -1
  177. package/dist/playground/assets/{latex-BxDKgDtB.js → latex-6W2WkeSm.js} +1 -1
  178. package/dist/playground/assets/{latte-sIa_hYpE.js → latte-CglMtwdD.js} +1 -1
  179. package/dist/playground/assets/{less-_WbmSkDo.js → less-DW5Lgaui.js} +1 -1
  180. package/dist/playground/assets/{lilypond-XTsZlQEd.js → lilypond-CAICi6OE.js} +1 -1
  181. package/dist/playground/assets/{liquid-CbpmLPd8.js → liquid-DJ8uaew9.js} +1 -1
  182. package/dist/playground/assets/{lisp--DGrBQo_.js → lisp-DZ9-4rBx.js} +1 -1
  183. package/dist/playground/assets/{livescript-BXC-d1_c.js → livescript-F2REdfVp.js} +1 -1
  184. package/dist/playground/assets/{llvm-B6VLG7JB.js → llvm-DcGgTbZW.js} +1 -1
  185. package/dist/playground/assets/{log-CdUPDQHo.js → log-D7q9Ii7p.js} +1 -1
  186. package/dist/playground/assets/{lolcode-CA9MM8Ym.js → lolcode-h7s8DH-s.js} +1 -1
  187. package/dist/playground/assets/{lua-X3_kYrGi.js → lua-B9KPiFAX.js} +1 -1
  188. package/dist/playground/assets/{magma-C23ER8I7.js → magma-CisiOExf.js} +1 -1
  189. package/dist/playground/assets/{makefile-JX5uV0ez.js → makefile-Boy85MPQ.js} +1 -1
  190. package/dist/playground/assets/{markdown-SUKXpTis.js → markdown-BZwwNKPM.js} +1 -1
  191. package/dist/playground/assets/{markup-B_Agf6Xg.js → markup-BIJRGo4x.js} +1 -1
  192. package/dist/playground/assets/{markup-templating-nareer9c.js → markup-templating-6ZLUg8vQ.js} +1 -1
  193. package/dist/playground/assets/{matlab-qo5qi2IC.js → matlab-DRc0uX9A.js} +1 -1
  194. package/dist/playground/assets/{maxscript-Cp88hlQG.js → maxscript-CiqqSyka.js} +1 -1
  195. package/dist/playground/assets/{mel-BK9kJBer.js → mel-JqQjDEoR.js} +1 -1
  196. package/dist/playground/assets/{mermaid-COJjsEcb.js → mermaid-BShs2ZUp.js} +1 -1
  197. package/dist/playground/assets/{mizar-zjOSTH3v.js → mizar-BF8GP180.js} +1 -1
  198. package/dist/playground/assets/{mongodb-D04uPW_L.js → mongodb-CNkYTayj.js} +1 -1
  199. package/dist/playground/assets/{monkey-BkuopbX3.js → monkey-D4krOf2k.js} +1 -1
  200. package/dist/playground/assets/{moonscript-Btuqus70.js → moonscript-C4fdGfle.js} +1 -1
  201. package/dist/playground/assets/{n1ql-9GtjVeOm.js → n1ql-CrelA5rC.js} +1 -1
  202. package/dist/playground/assets/{n4js-BonX0tJm.js → n4js-dZmo0cJc.js} +1 -1
  203. package/dist/playground/assets/{nand2tetris-hdl-TAJc7qcX.js → nand2tetris-hdl-94XUY5QI.js} +1 -1
  204. package/dist/playground/assets/{naniscript-BSsUuWRG.js → naniscript-Cvx0PN2t.js} +1 -1
  205. package/dist/playground/assets/{nasm-ciXgagUu.js → nasm-COaVNSB1.js} +1 -1
  206. package/dist/playground/assets/{neon-B-kJwpjX.js → neon-CDQw2p6a.js} +1 -1
  207. package/dist/playground/assets/{nevod-iJKBdgjD.js → nevod-CnY73_bO.js} +1 -1
  208. package/dist/playground/assets/{nginx-B0IG6grx.js → nginx-BjtIyBCx.js} +1 -1
  209. package/dist/playground/assets/{nim-Bgj-JbC0.js → nim-Bfs_nNa2.js} +1 -1
  210. package/dist/playground/assets/{nix-Cz3kVhxr.js → nix-D4FOItwn.js} +1 -1
  211. package/dist/playground/assets/{nsis-CfCQFOkq.js → nsis-CDx7F7hL.js} +1 -1
  212. package/dist/playground/assets/{objectivec-DAAGXg25.js → objectivec-CXShIBYr.js} +1 -1
  213. package/dist/playground/assets/{ocaml-BFwJqzew.js → ocaml-DrwgqXOl.js} +1 -1
  214. package/dist/playground/assets/{opencl-C7FCRzzI.js → opencl-C5FcwZ_U.js} +1 -1
  215. package/dist/playground/assets/{openqasm-CXs_gtKY.js → openqasm-C_yV_Yhc.js} +1 -1
  216. package/dist/playground/assets/{oz-C51rF8PD.js → oz-BCwwfzjH.js} +1 -1
  217. package/dist/playground/assets/{parigp-CCO0AIym.js → parigp-CvA6EMPF.js} +1 -1
  218. package/dist/playground/assets/{parser-DrS1UKiT.js → parser-CzJ2nwUr.js} +1 -1
  219. package/dist/playground/assets/{pascal-wqmqO_5o.js → pascal-JIn8eypV.js} +1 -1
  220. package/dist/playground/assets/{pascaligo-BbepEJ41.js → pascaligo-Cl0M8e9O.js} +1 -1
  221. package/dist/playground/assets/{pcaxis-BAisUZsW.js → pcaxis-hGQDqEux.js} +1 -1
  222. package/dist/playground/assets/{peoplecode-ClQP8SiR.js → peoplecode-Phtv4cwA.js} +1 -1
  223. package/dist/playground/assets/{perl-CoAVWnZR.js → perl-C_Ec8MpF.js} +1 -1
  224. package/dist/playground/assets/{php-BGE0wM6d.js → php-B3vNrode.js} +1 -1
  225. package/dist/playground/assets/{php-extras-ta9kHPLK.js → php-extras-DJrSCPGM.js} +1 -1
  226. package/dist/playground/assets/{phpdoc-BHmi3Xw5.js → phpdoc-CRCiPGtg.js} +1 -1
  227. package/dist/playground/assets/{plsql-BcMjCOc8.js → plsql-FXTwasXU.js} +1 -1
  228. package/dist/playground/assets/{powerquery-Dmr43PAp.js → powerquery-s5uyyNjT.js} +1 -1
  229. package/dist/playground/assets/{powershell-B7SW1rsn.js → powershell-BkzKhuf5.js} +1 -1
  230. package/dist/playground/assets/{processing-Dby7W0Ho.js → processing-DA3o6Ty8.js} +1 -1
  231. package/dist/playground/assets/{prolog-c722T3tD.js → prolog-BKokkpRI.js} +1 -1
  232. package/dist/playground/assets/{promql-k23taec2.js → promql-DxEc5NJb.js} +1 -1
  233. package/dist/playground/assets/{properties-BNR9Fwfi.js → properties-iZEtzZKv.js} +1 -1
  234. package/dist/playground/assets/{protobuf-q1r2AWcO.js → protobuf-CUnuOTE6.js} +1 -1
  235. package/dist/playground/assets/{psl-1WHqEVDY.js → psl-CMHiUou0.js} +1 -1
  236. package/dist/playground/assets/{pug-bHvKP2w5.js → pug-DEpeDWIA.js} +1 -1
  237. package/dist/playground/assets/{puppet-BF1OH03f.js → puppet-B-oUxTCI.js} +1 -1
  238. package/dist/playground/assets/{pure-ByW6PJsH.js → pure-BtzHyX42.js} +1 -1
  239. package/dist/playground/assets/{purebasic-D25dQBxi.js → purebasic-CbEqly3a.js} +1 -1
  240. package/dist/playground/assets/{purescript-BJPESOL7.js → purescript-BuR21UsZ.js} +1 -1
  241. package/dist/playground/assets/{python-Cnz9YLOS.js → python-C0UnJiNs.js} +1 -1
  242. package/dist/playground/assets/{q-D5RxzEav.js → q-ByF3ebz9.js} +1 -1
  243. package/dist/playground/assets/{qml-v3sEp1Nz.js → qml-BrctpvPn.js} +1 -1
  244. package/dist/playground/assets/{qore-CUzoWck8.js → qore-DgwuAky0.js} +1 -1
  245. package/dist/playground/assets/{qsharp-BR6udch0.js → qsharp-D0GNxX-R.js} +1 -1
  246. package/dist/playground/assets/{r-DtrnSvyc.js → r-COJ5RCzD.js} +1 -1
  247. package/dist/playground/assets/{racket-Cu_ZGXuW.js → racket-CwlQGMaI.js} +1 -1
  248. package/dist/playground/assets/{reason-DHTZDEHb.js → reason-7EfqU5J9.js} +1 -1
  249. package/dist/playground/assets/{regex-CYT-yoS5.js → regex-tNdlhkFB.js} +1 -1
  250. package/dist/playground/assets/{rego-Fsk3UvDq.js → rego-CDroqHyn.js} +1 -1
  251. package/dist/playground/assets/{renpy-CkM7FDu3.js → renpy-pkUobVx-.js} +1 -1
  252. package/dist/playground/assets/{rest-D3lFDhVd.js → rest-Bf89LEwH.js} +1 -1
  253. package/dist/playground/assets/{rip-Bv4-CVxz.js → rip-CnBO8xeH.js} +1 -1
  254. package/dist/playground/assets/{roboconf-DdhbaA-U.js → roboconf-D8lY4hLp.js} +1 -1
  255. package/dist/playground/assets/{robotframework-BUf5YQQi.js → robotframework-C7VQwQlQ.js} +1 -1
  256. package/dist/playground/assets/{ruby-BLkB9e66.js → ruby-BBGr4WXw.js} +1 -1
  257. package/dist/playground/assets/{rust-KAEed0Vw.js → rust-Cv_yMsna.js} +1 -1
  258. package/dist/playground/assets/{sas-DVlUJh9D.js → sas-BefoVmTk.js} +1 -1
  259. package/dist/playground/assets/{sass-DjeOVXwK.js → sass-FpTZa_UJ.js} +1 -1
  260. package/dist/playground/assets/{scala-BVtMoYx1.js → scala-BFo7PYuM.js} +1 -1
  261. package/dist/playground/assets/{scheme-DjZzovwi.js → scheme-DUMNHkPf.js} +1 -1
  262. package/dist/playground/assets/{scss-D3QWEUAN.js → scss-Bt0oT4tM.js} +1 -1
  263. package/dist/playground/assets/{shell-session-Df93J000.js → shell-session-D9j3FvGI.js} +1 -1
  264. package/dist/playground/assets/{smali-BnGKQBit.js → smali-DAiHzOzy.js} +1 -1
  265. package/dist/playground/assets/{smalltalk-Dj8ip1ht.js → smalltalk-Cb2wZjp-.js} +1 -1
  266. package/dist/playground/assets/{smarty-B6RD1OQf.js → smarty-CHwQcR8y.js} +1 -1
  267. package/dist/playground/assets/{sml-Dp2ZMR9U.js → sml-BkB_3aX6.js} +1 -1
  268. package/dist/playground/assets/{solidity-BeXz00ac.js → solidity-B-AYRn75.js} +1 -1
  269. package/dist/playground/assets/{solution-file-CM_zjSz_.js → solution-file-BZCTLJ8E.js} +1 -1
  270. package/dist/playground/assets/{soy-7EGEJcbF.js → soy-DVlXUrIk.js} +1 -1
  271. package/dist/playground/assets/{sparql-C2IAUgdN.js → sparql-DYBMhyLG.js} +1 -1
  272. package/dist/playground/assets/{splunk-spl-COr8LRXZ.js → splunk-spl-D6pJ76zI.js} +1 -1
  273. package/dist/playground/assets/{sqf-CZg6aml5.js → sqf-B3BvZAXF.js} +1 -1
  274. package/dist/playground/assets/{sql-FKtZq-Oc.js → sql-OxDLYC24.js} +1 -1
  275. package/dist/playground/assets/{squirrel-BaqL5HPv.js → squirrel-DPuntqLi.js} +1 -1
  276. package/dist/playground/assets/{stan-D3POiwkS.js → stan-Cga860om.js} +1 -1
  277. package/dist/playground/assets/{stylus-DB8e5eIq.js → stylus-CD9I3ec0.js} +1 -1
  278. package/dist/playground/assets/{swift-C_Q49RwS.js → swift-DLJ-4tGG.js} +1 -1
  279. package/dist/playground/assets/{systemd-DLsUsLQW.js → systemd-C7BRKoLp.js} +1 -1
  280. package/dist/playground/assets/{t4-cs-BbowKtdc.js → t4-cs-BGyN3PzZ.js} +1 -1
  281. package/dist/playground/assets/{t4-templating-CtUl24-m.js → t4-templating-DaBQuSvH.js} +1 -1
  282. package/dist/playground/assets/{t4-vb-DfdTz3CM.js → t4-vb-C7VCIvbF.js} +1 -1
  283. package/dist/playground/assets/{tap-BYTZHFMA.js → tap-Ce8cos8W.js} +1 -1
  284. package/dist/playground/assets/{tcl-byxEAdox.js → tcl-aYMzqC1i.js} +1 -1
  285. package/dist/playground/assets/{textile-X_or-MKk.js → textile-CVc321Og.js} +1 -1
  286. package/dist/playground/assets/{toml-9yt3zt0O.js → toml-DKnowQgs.js} +1 -1
  287. package/dist/playground/assets/{tremor-B5E8xKxN.js → tremor-CWn59I5W.js} +1 -1
  288. package/dist/playground/assets/{tsx-Bh784wda.js → tsx-DOEV7jSC.js} +1 -1
  289. package/dist/playground/assets/{tt2-Qj2ZOCAb.js → tt2-DbV4GYoA.js} +1 -1
  290. package/dist/playground/assets/{turtle-ofypRGWb.js → turtle-BJTCS26D.js} +1 -1
  291. package/dist/playground/assets/{twig-DxJIm5Nt.js → twig-CscwsMwI.js} +1 -1
  292. package/dist/playground/assets/{typescript-k_asJNlP.js → typescript-Mw6TOtOD.js} +1 -1
  293. package/dist/playground/assets/{typoscript-CZVVvtlw.js → typoscript-yvBOege3.js} +1 -1
  294. package/dist/playground/assets/{unrealscript-14CeOVLB.js → unrealscript-37hKl-r5.js} +1 -1
  295. package/dist/playground/assets/{uorazor-CcyXwj4Z.js → uorazor-DDgBT9Av.js} +1 -1
  296. package/dist/playground/assets/{uri-CxbokCoe.js → uri-CcO-DUpY.js} +1 -1
  297. package/dist/playground/assets/{v-DaBg53O2.js → v-B5FYQFQw.js} +1 -1
  298. package/dist/playground/assets/{vala-yKxeqeMk.js → vala-SGktv3bh.js} +1 -1
  299. package/dist/playground/assets/{vbnet-zbARJ9N6.js → vbnet-BBmHgeeV.js} +1 -1
  300. package/dist/playground/assets/{velocity-i7KExc_F.js → velocity-CDAXJ-4L.js} +1 -1
  301. package/dist/playground/assets/{verilog-B8VXB4Bt.js → verilog-CTZrGURj.js} +1 -1
  302. package/dist/playground/assets/{vhdl-B0BoXMS5.js → vhdl-CqUI9V-s.js} +1 -1
  303. package/dist/playground/assets/{vim-CcwNfwiA.js → vim-aCrahUVK.js} +1 -1
  304. package/dist/playground/assets/{visual-basic-DMbVXrgw.js → visual-basic-uMyUwiHX.js} +1 -1
  305. package/dist/playground/assets/{warpscript-0wiMWvm5.js → warpscript-B3FwIrrc.js} +1 -1
  306. package/dist/playground/assets/{wasm-B7BleATd.js → wasm-BhdYlZJN.js} +1 -1
  307. package/dist/playground/assets/{web-idl-B5GpCf4c.js → web-idl-OcmPAUMs.js} +1 -1
  308. package/dist/playground/assets/{wiki-C4JDeepB.js → wiki-Dgync4cN.js} +1 -1
  309. package/dist/playground/assets/{wolfram-jfkSuw2F.js → wolfram-B3fJkmSv.js} +1 -1
  310. package/dist/playground/assets/{wren-CFOnTax2.js → wren-CiEMR5ii.js} +1 -1
  311. package/dist/playground/assets/{xeora-BN186LNY.js → xeora-CQs1FYZ7.js} +1 -1
  312. package/dist/playground/assets/{xml-doc--xK8czPH.js → xml-doc-C9wqUHW8.js} +1 -1
  313. package/dist/playground/assets/{xojo-Cd2Nu42N.js → xojo-4Eo1X1wd.js} +1 -1
  314. package/dist/playground/assets/{xquery-B6gXzC9P.js → xquery-DdqUerwM.js} +1 -1
  315. package/dist/playground/assets/{yaml-CF38fivN.js → yaml-BCtdvt9Y.js} +1 -1
  316. package/dist/playground/assets/{yang-CUKl-Ozk.js → yang-il6SZfEf.js} +1 -1
  317. package/dist/playground/assets/{zig-DEPczZ41.js → zig-C4UYtwNw.js} +1 -1
  318. package/dist/playground/index.html +1 -1
  319. package/package.json +7 -10
  320. package/dist/chunk-GK64AJRT.js.map +0 -1
  321. package/dist/commands/actions/deploy-project.d.ts +0 -2
  322. package/dist/commands/actions/deploy-project.d.ts.map +0 -1
  323. package/dist/commands/deploy/index.d.ts +0 -4
  324. package/dist/commands/deploy/index.d.ts.map +0 -1
@@ -1,203 +1,137 @@
1
1
  import { getAnalytics } from './chunk-OQQFOUQW.js';
2
- import * as p2 from '@clack/prompts';
2
+ import * as p from '@clack/prompts';
3
3
  import color2 from 'picocolors';
4
- import fs5 from 'fs/promises';
4
+ import fs4 from 'fs/promises';
5
5
  import child_process from 'child_process';
6
6
  import util from 'util';
7
- import path3 from 'path';
8
- import shellQuote from 'shell-quote';
9
- import yoctoSpinner from 'yocto-spinner';
10
- import { PinoLogger } from '@mastra/loggers';
11
- import * as fs4 from 'fs';
12
- import fs4__default, { existsSync } from 'fs';
13
- import { execa } from 'execa';
7
+ import path from 'path';
8
+ import shellQuote2 from 'shell-quote';
9
+ import yoctoSpinner2 from 'yocto-spinner';
10
+ import { InvalidArgumentError } from 'commander';
11
+ import * as fs3 from 'fs';
12
+ import fs3__default, { existsSync } from 'fs';
14
13
  import os from 'os';
15
14
  import fsExtra, { readJSON, ensureFile, writeJSON } from 'fs-extra/esm';
16
15
  import prettier from 'prettier';
16
+ import { execa } from 'execa';
17
17
  import { fileURLToPath } from 'url';
18
+ import { PinoLogger } from '@mastra/loggers';
18
19
 
19
- // src/commands/utils.ts
20
- function getPackageManager() {
21
- const userAgent = process.env.npm_config_user_agent || "";
22
- const execPath = process.env.npm_execpath || "";
23
- if (userAgent.includes("yarn")) {
24
- return "yarn";
25
- }
26
- if (userAgent.includes("pnpm")) {
27
- return "pnpm";
28
- }
29
- if (userAgent.includes("npm")) {
30
- return "npm";
31
- }
32
- if (execPath.includes("yarn")) {
33
- return "yarn";
34
- }
35
- if (execPath.includes("pnpm")) {
36
- return "pnpm";
20
+ var args = ["-y", "@mastra/mcp-docs-server"];
21
+ var createMcpConfig = (editor) => {
22
+ if (editor === "vscode") {
23
+ return {
24
+ servers: {
25
+ mastra: process.platform === `win32` ? {
26
+ command: "cmd",
27
+ args: ["/c", "npx", ...args],
28
+ type: "stdio"
29
+ } : {
30
+ command: "npx",
31
+ args,
32
+ type: "stdio"
33
+ }
34
+ }
35
+ };
37
36
  }
38
- if (execPath.includes("npm")) {
39
- return "npm";
37
+ return {
38
+ mcpServers: {
39
+ mastra: {
40
+ command: "npx",
41
+ args
42
+ }
43
+ }
44
+ };
45
+ };
46
+ function makeConfig(original, editor) {
47
+ if (editor === "vscode") {
48
+ return {
49
+ ...original,
50
+ servers: {
51
+ ...original?.servers || {},
52
+ ...createMcpConfig(editor).servers
53
+ }
54
+ };
40
55
  }
41
- return "npm";
56
+ return {
57
+ ...original,
58
+ mcpServers: {
59
+ ...original?.mcpServers || {},
60
+ ...createMcpConfig(editor).mcpServers
61
+ }
62
+ };
42
63
  }
43
- var logger = createLogger(false);
44
- function createLogger(debug = false) {
45
- return new PinoLogger({
46
- name: "Mastra CLI",
47
- level: debug ? "debug" : "info"
64
+ async function writeMergedConfig(configPath, editor) {
65
+ const configExists = existsSync(configPath);
66
+ const config = makeConfig(configExists ? await readJSON(configPath) : {}, editor);
67
+ await ensureFile(configPath);
68
+ await writeJSON(configPath, config, {
69
+ spaces: 2
48
70
  });
49
71
  }
50
-
51
- // src/utils/clone-template.ts
52
- var exec = util.promisify(child_process.exec);
53
- async function cloneTemplate(options) {
54
- const { template, projectName, targetDir } = options;
55
- const projectPath = targetDir ? path3.resolve(targetDir, projectName) : path3.resolve(projectName);
56
- const spinner5 = yoctoSpinner({ text: `Cloning template "${template.title}"...` }).start();
57
- try {
58
- if (await directoryExists(projectPath)) {
59
- spinner5.error(`Directory ${projectName} already exists`);
60
- throw new Error(`Directory ${projectName} already exists`);
61
- }
62
- await cloneRepositoryWithoutGit(template.githubUrl, projectPath);
63
- await updatePackageJson(projectPath, projectName);
64
- const envExamplePath = path3.join(projectPath, ".env.example");
65
- if (await fileExists(envExamplePath)) {
66
- await fs5.copyFile(envExamplePath, path3.join(projectPath, ".env"));
67
- }
68
- spinner5.success(`Template "${template.title}" cloned successfully to ${projectName}`);
69
- return projectPath;
70
- } catch (error) {
71
- spinner5.error(`Failed to clone template: ${error instanceof Error ? error.message : "Unknown error"}`);
72
- throw error;
73
- }
72
+ var windsurfGlobalMCPConfigPath = path.join(os.homedir(), ".codeium", "windsurf", "mcp_config.json");
73
+ var cursorGlobalMCPConfigPath = path.join(os.homedir(), ".cursor", "mcp.json");
74
+ path.join(process.cwd(), ".vscode", "mcp.json");
75
+ var vscodeGlobalMCPConfigPath = path.join(
76
+ os.homedir(),
77
+ process.platform === "win32" ? path.join("AppData", "Roaming", "Code", "User", "settings.json") : process.platform === "darwin" ? path.join("Library", "Application Support", "Code", "User", "settings.json") : path.join(".config", "Code", "User", "settings.json")
78
+ );
79
+ var EDITOR = ["cursor", "cursor-global", "windsurf", "vscode"];
80
+ function isValidEditor(value) {
81
+ return EDITOR.includes(value);
74
82
  }
75
- async function directoryExists(dirPath) {
76
- try {
77
- const stat = await fs5.stat(dirPath);
78
- return stat.isDirectory();
79
- } catch {
80
- return false;
83
+ async function installMastraDocsMCPServer({ editor, directory }) {
84
+ if (editor === `cursor`) {
85
+ await writeMergedConfig(path.join(directory, ".cursor", "mcp.json"), "cursor");
81
86
  }
82
- }
83
- async function fileExists(filePath) {
84
- try {
85
- const stat = await fs5.stat(filePath);
86
- return stat.isFile();
87
- } catch {
88
- return false;
87
+ if (editor === `vscode`) {
88
+ await writeMergedConfig(path.join(directory, ".vscode", "mcp.json"), "vscode");
89
89
  }
90
- }
91
- async function cloneRepositoryWithoutGit(repoUrl, targetPath) {
92
- await fs5.mkdir(targetPath, { recursive: true });
93
- try {
94
- const degitRepo = repoUrl.replace("https://github.com/", "");
95
- const degitCommand = shellQuote.quote(["npx", "degit", degitRepo, targetPath]);
96
- await exec(degitCommand, {
97
- cwd: process.cwd()
98
- });
99
- } catch {
100
- try {
101
- const gitCommand = shellQuote.quote(["git", "clone", repoUrl, targetPath]);
102
- await exec(gitCommand, {
103
- cwd: process.cwd()
104
- });
105
- const gitDir = path3.join(targetPath, ".git");
106
- if (await directoryExists(gitDir)) {
107
- await fs5.rm(gitDir, { recursive: true, force: true });
108
- }
109
- } catch (gitError) {
110
- throw new Error(`Failed to clone repository: ${gitError instanceof Error ? gitError.message : "Unknown error"}`);
90
+ if (editor === `cursor-global`) {
91
+ const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor);
92
+ if (alreadyInstalled) {
93
+ return;
111
94
  }
95
+ await writeMergedConfig(cursorGlobalMCPConfigPath, "cursor-global");
112
96
  }
113
- }
114
- async function updatePackageJson(projectPath, projectName) {
115
- const packageJsonPath = path3.join(projectPath, "package.json");
116
- try {
117
- const packageJsonContent = await fs5.readFile(packageJsonPath, "utf-8");
118
- const packageJson = JSON.parse(packageJsonContent);
119
- packageJson.name = projectName;
120
- await fs5.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
121
- } catch (error) {
122
- logger.warn(`Could not update package.json: ${error instanceof Error ? error.message : "Unknown error"}`);
97
+ if (editor === `windsurf`) {
98
+ const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor);
99
+ if (alreadyInstalled) {
100
+ return;
101
+ }
102
+ await writeMergedConfig(windsurfGlobalMCPConfigPath, editor);
123
103
  }
124
104
  }
125
- async function installDependencies(projectPath, packageManager) {
126
- const spinner5 = yoctoSpinner({ text: "Installing dependencies..." }).start();
127
- try {
128
- const pm = packageManager || getPackageManager();
129
- const installCommand = shellQuote.quote([pm, "install"]);
130
- await exec(installCommand, {
131
- cwd: projectPath
132
- });
133
- spinner5.success("Dependencies installed successfully");
134
- } catch (error) {
135
- spinner5.error(`Failed to install dependencies: ${error instanceof Error ? error.message : "Unknown error"}`);
136
- throw error;
105
+ async function globalMCPIsAlreadyInstalled(editor) {
106
+ let configPath = ``;
107
+ if (editor === "windsurf") {
108
+ configPath = windsurfGlobalMCPConfigPath;
109
+ } else if (editor === "cursor-global") {
110
+ configPath = cursorGlobalMCPConfigPath;
111
+ } else if (editor === "vscode") {
112
+ configPath = vscodeGlobalMCPConfigPath;
137
113
  }
138
- }
139
- var TEMPLATES_API_URL = process.env.MASTRA_TEMPLATES_API_URL || "https://mastra.ai/api/templates.json";
140
- async function loadTemplates() {
141
- try {
142
- const response = await fetch(TEMPLATES_API_URL);
143
- if (!response.ok) {
144
- throw new Error(`Failed to fetch templates: ${response.statusText}`);
145
- }
146
- const templates = await response.json();
147
- return templates;
148
- } catch (error) {
149
- console.error("Error loading templates:", error);
150
- throw new Error("Failed to load templates. Please check your internet connection and try again.");
114
+ if (!configPath || !existsSync(configPath)) {
115
+ return false;
151
116
  }
152
- }
153
- function pluralize(count, singular, plural) {
154
- return count === 1 ? singular : plural || `${singular}s`;
155
- }
156
- async function selectTemplate(templates) {
157
- const choices = templates.map((template) => {
158
- const parts = [];
159
- if (template.agents?.length) {
160
- parts.push(`${template.agents.length} ${pluralize(template.agents.length, "agent")}`);
161
- }
162
- if (template.tools?.length) {
163
- parts.push(`${template.tools.length} ${pluralize(template.tools.length, "tool")}`);
164
- }
165
- if (template.workflows?.length) {
166
- parts.push(`${template.workflows.length} ${pluralize(template.workflows.length, "workflow")}`);
167
- }
168
- if (template.mcp?.length) {
169
- parts.push(`${template.mcp.length} ${pluralize(template.mcp.length, "MCP server")}`);
170
- }
171
- if (template.networks?.length) {
172
- parts.push(`${template.networks.length} ${pluralize(template.networks.length, "agent network")}`);
117
+ try {
118
+ const configContents = await readJSON(configPath);
119
+ if (!configContents) return false;
120
+ if (editor === "vscode") {
121
+ if (!configContents.servers) return false;
122
+ const hasMastraMCP2 = Object.values(configContents.servers).some(
123
+ (server) => server?.args?.find((arg) => arg?.includes(`@mastra/mcp-docs-server`))
124
+ );
125
+ return hasMastraMCP2;
173
126
  }
174
- return {
175
- value: template,
176
- label: template.title,
177
- hint: parts.join(", ") || "Template components"
178
- };
179
- });
180
- const selected = await p2.select({
181
- message: "Select a template:",
182
- options: choices
183
- });
184
- if (p2.isCancel(selected)) {
185
- return null;
127
+ if (!configContents?.mcpServers) return false;
128
+ const hasMastraMCP = Object.values(configContents.mcpServers).some(
129
+ (server) => server?.args?.find((arg) => arg?.includes(`@mastra/mcp-docs-server`))
130
+ );
131
+ return hasMastraMCP;
132
+ } catch {
133
+ return false;
186
134
  }
187
- return selected;
188
- }
189
- function findTemplateByName(templates, templateName) {
190
- let template = templates.find((t) => t.slug === templateName);
191
- if (template) return template;
192
- const slugWithPrefix = `template-${templateName}`;
193
- template = templates.find((t) => t.slug === slugWithPrefix);
194
- if (template) return template;
195
- template = templates.find((t) => t.title.toLowerCase() === templateName.toLowerCase());
196
- if (template) return template;
197
- return null;
198
- }
199
- function getDefaultProjectName(template) {
200
- return template.slug.replace(/^template-/, "");
201
135
  }
202
136
 
203
137
  // src/utils/package-manager.ts
@@ -225,11 +159,11 @@ var DepsService = class {
225
159
  findLockFile(dir) {
226
160
  const lockFiles = ["pnpm-lock.yaml", "package-lock.json", "yarn.lock", "bun.lock"];
227
161
  for (const file of lockFiles) {
228
- if (fs4__default.existsSync(path3.join(dir, file))) {
162
+ if (fs3__default.existsSync(path.join(dir, file))) {
229
163
  return file;
230
164
  }
231
165
  }
232
- const parentDir = path3.resolve(dir, "..");
166
+ const parentDir = path.resolve(dir, "..");
233
167
  if (parentDir !== dir) {
234
168
  return this.findLockFile(parentDir);
235
169
  }
@@ -245,172 +179,60 @@ var DepsService = class {
245
179
  case "yarn.lock":
246
180
  return "yarn";
247
181
  case "bun.lock":
248
- return "bun";
249
- default:
250
- return "npm";
251
- }
252
- }
253
- async installPackages(packages) {
254
- const pm = this.packageManager;
255
- const installCommand = getPackageManagerAddCommand(pm);
256
- const packageList = packages.join(" ");
257
- return execa(`${pm} ${installCommand} ${packageList}`, {
258
- all: true,
259
- shell: true,
260
- stdio: "inherit"
261
- });
262
- }
263
- async checkDependencies(dependencies) {
264
- try {
265
- const packageJsonPath = path3.join(process.cwd(), "package.json");
266
- try {
267
- await fs5.access(packageJsonPath);
268
- } catch {
269
- return "No package.json file found in the current directory";
270
- }
271
- const packageJson = JSON.parse(await fs5.readFile(packageJsonPath, "utf-8"));
272
- for (const dependency of dependencies) {
273
- if (!packageJson.dependencies || !packageJson.dependencies[dependency]) {
274
- return `Please install ${dependency} before running this command (${this.packageManager} install ${dependency})`;
275
- }
276
- }
277
- return "ok";
278
- } catch (err) {
279
- console.error(err);
280
- return "Could not check dependencies";
281
- }
282
- }
283
- async getProjectName() {
284
- try {
285
- const packageJsonPath = path3.join(process.cwd(), "package.json");
286
- const packageJson = await fs5.readFile(packageJsonPath, "utf-8");
287
- const pkg = JSON.parse(packageJson);
288
- return pkg.name;
289
- } catch (err) {
290
- throw err;
291
- }
292
- }
293
- async addScriptsToPackageJson(scripts) {
294
- const packageJson = JSON.parse(await fs5.readFile("package.json", "utf-8"));
295
- packageJson.scripts = {
296
- ...packageJson.scripts,
297
- ...scripts
298
- };
299
- await fs5.writeFile("package.json", JSON.stringify(packageJson, null, 2));
300
- }
301
- };
302
- var args = ["-y", "@mastra/mcp-docs-server"];
303
- var createMcpConfig = (editor) => {
304
- if (editor === "vscode") {
305
- return {
306
- servers: {
307
- mastra: process.platform === `win32` ? {
308
- command: "cmd",
309
- args: ["/c", "npx", ...args],
310
- type: "stdio"
311
- } : {
312
- command: "npx",
313
- args,
314
- type: "stdio"
315
- }
316
- }
317
- };
318
- }
319
- return {
320
- mcpServers: {
321
- mastra: {
322
- command: "npx",
323
- args
324
- }
325
- }
326
- };
327
- };
328
- function makeConfig(original, editor) {
329
- if (editor === "vscode") {
330
- return {
331
- ...original,
332
- servers: {
333
- ...original?.servers || {},
334
- ...createMcpConfig(editor).servers
335
- }
336
- };
337
- }
338
- return {
339
- ...original,
340
- mcpServers: {
341
- ...original?.mcpServers || {},
342
- ...createMcpConfig(editor).mcpServers
343
- }
344
- };
345
- }
346
- async function writeMergedConfig(configPath, editor) {
347
- const configExists = existsSync(configPath);
348
- const config = makeConfig(configExists ? await readJSON(configPath) : {}, editor);
349
- await ensureFile(configPath);
350
- await writeJSON(configPath, config, {
351
- spaces: 2
352
- });
353
- }
354
- var windsurfGlobalMCPConfigPath = path3.join(os.homedir(), ".codeium", "windsurf", "mcp_config.json");
355
- var cursorGlobalMCPConfigPath = path3.join(os.homedir(), ".cursor", "mcp.json");
356
- path3.join(process.cwd(), ".vscode", "mcp.json");
357
- var vscodeGlobalMCPConfigPath = path3.join(
358
- os.homedir(),
359
- process.platform === "win32" ? path3.join("AppData", "Roaming", "Code", "User", "settings.json") : process.platform === "darwin" ? path3.join("Library", "Application Support", "Code", "User", "settings.json") : path3.join(".config", "Code", "User", "settings.json")
360
- );
361
- async function installMastraDocsMCPServer({ editor, directory }) {
362
- if (editor === `cursor`) {
363
- await writeMergedConfig(path3.join(directory, ".cursor", "mcp.json"), "cursor");
182
+ return "bun";
183
+ default:
184
+ return "npm";
185
+ }
364
186
  }
365
- if (editor === `vscode`) {
366
- await writeMergedConfig(path3.join(directory, ".vscode", "mcp.json"), "vscode");
187
+ async installPackages(packages) {
188
+ const pm = this.packageManager;
189
+ const installCommand = getPackageManagerAddCommand(pm);
190
+ const packageList = packages.join(" ");
191
+ return execa(`${pm} ${installCommand} ${packageList}`, {
192
+ all: true,
193
+ shell: true,
194
+ stdio: "inherit"
195
+ });
367
196
  }
368
- if (editor === `cursor-global`) {
369
- const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor);
370
- if (alreadyInstalled) {
371
- return;
197
+ async checkDependencies(dependencies) {
198
+ try {
199
+ const packageJsonPath = path.join(process.cwd(), "package.json");
200
+ try {
201
+ await fs4.access(packageJsonPath);
202
+ } catch {
203
+ return "No package.json file found in the current directory";
204
+ }
205
+ const packageJson = JSON.parse(await fs4.readFile(packageJsonPath, "utf-8"));
206
+ for (const dependency of dependencies) {
207
+ if (!packageJson.dependencies || !packageJson.dependencies[dependency]) {
208
+ return `Please install ${dependency} before running this command (${this.packageManager} install ${dependency})`;
209
+ }
210
+ }
211
+ return "ok";
212
+ } catch (err) {
213
+ console.error(err);
214
+ return "Could not check dependencies";
372
215
  }
373
- await writeMergedConfig(cursorGlobalMCPConfigPath, "cursor-global");
374
216
  }
375
- if (editor === `windsurf`) {
376
- const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor);
377
- if (alreadyInstalled) {
378
- return;
217
+ async getProjectName() {
218
+ try {
219
+ const packageJsonPath = path.join(process.cwd(), "package.json");
220
+ const packageJson = await fs4.readFile(packageJsonPath, "utf-8");
221
+ const pkg = JSON.parse(packageJson);
222
+ return pkg.name;
223
+ } catch (err) {
224
+ throw err;
379
225
  }
380
- await writeMergedConfig(windsurfGlobalMCPConfigPath, editor);
381
- }
382
- }
383
- async function globalMCPIsAlreadyInstalled(editor) {
384
- let configPath = ``;
385
- if (editor === "windsurf") {
386
- configPath = windsurfGlobalMCPConfigPath;
387
- } else if (editor === "cursor-global") {
388
- configPath = cursorGlobalMCPConfigPath;
389
- } else if (editor === "vscode") {
390
- configPath = vscodeGlobalMCPConfigPath;
391
- }
392
- if (!configPath || !existsSync(configPath)) {
393
- return false;
394
226
  }
395
- try {
396
- const configContents = await readJSON(configPath);
397
- if (!configContents) return false;
398
- if (editor === "vscode") {
399
- if (!configContents.servers) return false;
400
- const hasMastraMCP2 = Object.values(configContents.servers).some(
401
- (server) => server?.args?.find((arg) => arg?.includes(`@mastra/mcp-docs-server`))
402
- );
403
- return hasMastraMCP2;
404
- }
405
- if (!configContents?.mcpServers) return false;
406
- const hasMastraMCP = Object.values(configContents.mcpServers).some(
407
- (server) => server?.args?.find((arg) => arg?.includes(`@mastra/mcp-docs-server`))
408
- );
409
- return hasMastraMCP;
410
- } catch {
411
- return false;
227
+ async addScriptsToPackageJson(scripts) {
228
+ const packageJson = JSON.parse(await fs4.readFile("package.json", "utf-8"));
229
+ packageJson.scripts = {
230
+ ...packageJson.scripts,
231
+ ...scripts
232
+ };
233
+ await fs4.writeFile("package.json", JSON.stringify(packageJson, null, 2));
412
234
  }
413
- }
235
+ };
414
236
 
415
237
  // src/services/service.env.ts
416
238
  var EnvService = class {
@@ -425,7 +247,7 @@ var FileEnvService = class extends EnvService {
425
247
  }
426
248
  readFile(filePath) {
427
249
  return new Promise((resolve, reject) => {
428
- fs4.readFile(filePath, "utf8", (err, data) => {
250
+ fs3.readFile(filePath, "utf8", (err, data) => {
429
251
  if (err) reject(err);
430
252
  else resolve(data);
431
253
  });
@@ -433,7 +255,7 @@ var FileEnvService = class extends EnvService {
433
255
  }
434
256
  writeFile({ filePath, data }) {
435
257
  return new Promise((resolve, reject) => {
436
- fs4.writeFile(filePath, data, "utf8", (err) => {
258
+ fs3.writeFile(filePath, data, "utf8", (err) => {
437
259
  if (err) reject(err);
438
260
  else resolve();
439
261
  });
@@ -488,10 +310,10 @@ var FileService = class {
488
310
  */
489
311
  async copyStarterFile(inputFile, outputFilePath, replaceIfExists) {
490
312
  const __filename = fileURLToPath(import.meta.url);
491
- const __dirname = path3.dirname(__filename);
492
- const filePath = path3.resolve(__dirname, "starter-files", inputFile);
493
- const fileString = fs4__default.readFileSync(filePath, "utf8");
494
- if (fs4__default.existsSync(outputFilePath) && !replaceIfExists) {
313
+ const __dirname = path.dirname(__filename);
314
+ const filePath = path.resolve(__dirname, "starter-files", inputFile);
315
+ const fileString = fs3__default.readFileSync(filePath, "utf8");
316
+ if (fs3__default.existsSync(outputFilePath) && !replaceIfExists) {
495
317
  console.info(`${outputFilePath} already exists`);
496
318
  return false;
497
319
  }
@@ -499,14 +321,14 @@ var FileService = class {
499
321
  return true;
500
322
  }
501
323
  async setupEnvFile({ dbUrl }) {
502
- const envPath = path3.join(process.cwd(), ".env.development");
324
+ const envPath = path.join(process.cwd(), ".env.development");
503
325
  await fsExtra.ensureFile(envPath);
504
326
  const fileEnvService = new FileEnvService(envPath);
505
327
  await fileEnvService.setEnvValue("DB_URL", dbUrl);
506
328
  }
507
329
  getFirstExistingFile(files) {
508
330
  for (const f of files) {
509
- if (fs4__default.existsSync(f)) {
331
+ if (fs3__default.existsSync(f)) {
510
332
  return f;
511
333
  }
512
334
  }
@@ -516,16 +338,24 @@ var FileService = class {
516
338
  filePath,
517
339
  replacements
518
340
  }) {
519
- let fileContent = fs4__default.readFileSync(filePath, "utf8");
341
+ let fileContent = fs3__default.readFileSync(filePath, "utf8");
520
342
  replacements.forEach(({ search, replace }) => {
521
343
  fileContent = fileContent.replaceAll(search, replace);
522
344
  });
523
- fs4__default.writeFileSync(filePath, fileContent);
345
+ fs3__default.writeFileSync(filePath, fileContent);
524
346
  }
525
347
  };
526
348
 
527
349
  // src/commands/init/utils.ts
528
- var exec2 = util.promisify(child_process.exec);
350
+ var exec = util.promisify(child_process.exec);
351
+ var LLMProvider = ["openai", "anthropic", "groq", "google", "cerebras", "mistral"];
352
+ var COMPONENTS = ["agents", "workflows", "tools"];
353
+ function isValidLLMProvider(value) {
354
+ return LLMProvider.includes(value);
355
+ }
356
+ function areValidComponents(values) {
357
+ return values.every((value) => COMPONENTS.includes(value));
358
+ }
529
359
  var getModelIdentifier = (llmProvider) => {
530
360
  if (llmProvider === "openai") {
531
361
  return `'openai/gpt-4o-mini'`;
@@ -579,8 +409,8 @@ export const weatherAgent = new Agent({
579
409
  parser: "typescript",
580
410
  singleQuote: true
581
411
  });
582
- await fs5.writeFile(destPath, "");
583
- await fs5.writeFile(destPath, formattedContent);
412
+ await fs4.writeFile(destPath, "");
413
+ await fs4.writeFile(destPath, formattedContent);
584
414
  }
585
415
  async function writeWorkflowSample(destPath) {
586
416
  const content = `import { createStep, createWorkflow } from '@mastra/core/workflows';
@@ -773,7 +603,7 @@ export { weatherWorkflow };`;
773
603
  semi: true,
774
604
  singleQuote: true
775
605
  });
776
- await fs5.writeFile(destPath, formattedContent);
606
+ await fs4.writeFile(destPath, formattedContent);
777
607
  }
778
608
  async function writeToolSample(destPath) {
779
609
  const fileService = new FileService();
@@ -802,15 +632,15 @@ var writeIndexFile = async ({
802
632
  addWorkflow
803
633
  }) => {
804
634
  const indexPath = dirPath + "/index.ts";
805
- const destPath = path3.join(indexPath);
635
+ const destPath = path.join(indexPath);
806
636
  try {
807
- await fs5.writeFile(destPath, "");
637
+ await fs4.writeFile(destPath, "");
808
638
  const filteredExports = [
809
639
  addWorkflow ? `workflows: { weatherWorkflow },` : "",
810
640
  addAgent ? `agents: { weatherAgent },` : ""
811
641
  ].filter(Boolean);
812
642
  if (!addExample) {
813
- await fs5.writeFile(
643
+ await fs4.writeFile(
814
644
  destPath,
815
645
  `
816
646
  import { Mastra } from '@mastra/core';
@@ -820,7 +650,7 @@ export const mastra = new Mastra()
820
650
  );
821
651
  return;
822
652
  }
823
- await fs5.writeFile(
653
+ await fs4.writeFile(
824
654
  destPath,
825
655
  `
826
656
  import { Mastra } from '@mastra/core/mastra';
@@ -862,7 +692,7 @@ var checkAndInstallCoreDeps = async (addExample) => {
862
692
  await installCoreDeps("@mastra/core");
863
693
  }
864
694
  if (needsZod) {
865
- await installCoreDeps("zod", "^3");
695
+ await installCoreDeps("zod", "^4");
866
696
  }
867
697
  if (addExample) {
868
698
  const needsLibsql = await depService.checkDependencies(["@mastra/libsql"]) !== `ok`;
@@ -871,19 +701,19 @@ var checkAndInstallCoreDeps = async (addExample) => {
871
701
  }
872
702
  }
873
703
  };
874
- var spinner = yoctoSpinner({ text: "Installing Mastra core dependencies\n" });
704
+ var spinner = yoctoSpinner2({ text: "Installing Mastra core dependencies\n" });
875
705
  async function installCoreDeps(pkg, version = "latest") {
876
706
  try {
877
- const confirm2 = await p2.confirm({
707
+ const confirm2 = await p.confirm({
878
708
  message: `You do not have the ${pkg} package installed. Would you like to install it?`,
879
709
  initialValue: false
880
710
  });
881
- if (p2.isCancel(confirm2)) {
882
- p2.cancel("Installation Cancelled");
711
+ if (p.isCancel(confirm2)) {
712
+ p.cancel("Installation Cancelled");
883
713
  process.exit(0);
884
714
  }
885
715
  if (!confirm2) {
886
- p2.cancel("Installation Cancelled");
716
+ p.cancel("Installation Cancelled");
887
717
  process.exit(0);
888
718
  }
889
719
  spinner.start();
@@ -919,15 +749,15 @@ var getAPIKey = async (provider) => {
919
749
  var writeAPIKey = async ({ provider, apiKey }) => {
920
750
  const envFileName = apiKey ? ".env" : ".env.example";
921
751
  const key = await getAPIKey(provider);
922
- const escapedKey = shellQuote.quote([key]);
923
- const escapedApiKey = shellQuote.quote([apiKey ? apiKey : "your-api-key"]);
924
- await exec2(`echo ${escapedKey}=${escapedApiKey} >> ${envFileName}`);
752
+ const escapedKey = shellQuote2.quote([key]);
753
+ const escapedApiKey = shellQuote2.quote([apiKey ? apiKey : "your-api-key"]);
754
+ await exec(`echo ${escapedKey}=${escapedApiKey} >> ${envFileName}`);
925
755
  };
926
756
  var createMastraDir = async (directory) => {
927
757
  let dir = directory.trim().split("/").filter((item) => item !== "");
928
- const dirPath = path3.join(process.cwd(), ...dir, "mastra");
758
+ const dirPath = path.join(process.cwd(), ...dir, "mastra");
929
759
  try {
930
- await fs5.access(dirPath);
760
+ await fs4.access(dirPath);
931
761
  return { ok: false };
932
762
  } catch {
933
763
  await fsExtra.ensureDir(dirPath);
@@ -953,23 +783,23 @@ var LLM_PROVIDERS = [
953
783
  var interactivePrompt = async (args2 = {}) => {
954
784
  const { skip = {}, options: { showBanner = true } = {} } = args2;
955
785
  if (showBanner) {
956
- p2.intro(color2.inverse(" Mastra Init "));
786
+ p.intro(color2.inverse(" Mastra Init "));
957
787
  }
958
- const mastraProject = await p2.group(
788
+ const mastraProject = await p.group(
959
789
  {
960
- directory: () => p2.text({
790
+ directory: () => p.text({
961
791
  message: "Where should we create the Mastra files? (default: src/)",
962
792
  placeholder: "src/",
963
793
  defaultValue: "src/"
964
794
  }),
965
- llmProvider: () => skip?.llmProvider ? void 0 : p2.select({
795
+ llmProvider: () => skip?.llmProvider ? void 0 : p.select({
966
796
  message: "Select a default provider:",
967
797
  options: LLM_PROVIDERS
968
798
  }),
969
799
  llmApiKey: async ({ results: { llmProvider } }) => {
970
800
  if (skip?.llmApiKey) return void 0;
971
801
  const llmName = LLM_PROVIDERS.find((p6) => p6.value === llmProvider)?.label || "provider";
972
- const keyChoice = await p2.select({
802
+ const keyChoice = await p.select({
973
803
  message: `Enter your ${llmName} API key?`,
974
804
  options: [
975
805
  { value: "skip", label: "Skip for now", hint: "default" },
@@ -978,7 +808,7 @@ var interactivePrompt = async (args2 = {}) => {
978
808
  initialValue: "skip"
979
809
  });
980
810
  if (keyChoice === "enter") {
981
- return p2.text({
811
+ return p.text({
982
812
  message: "Enter your API key:",
983
813
  placeholder: "sk-...",
984
814
  validate: (value) => {
@@ -992,7 +822,7 @@ var interactivePrompt = async (args2 = {}) => {
992
822
  const windsurfIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`windsurf`);
993
823
  const cursorIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`cursor`);
994
824
  const vscodeIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`vscode`);
995
- const editor = await p2.select({
825
+ const editor = await p.select({
996
826
  message: `Make your IDE into a Mastra expert? (Installs Mastra's MCP server)`,
997
827
  options: [
998
828
  { value: "skip", label: "Skip for now", hint: "default" },
@@ -1020,24 +850,24 @@ var interactivePrompt = async (args2 = {}) => {
1020
850
  });
1021
851
  if (editor === `skip`) return void 0;
1022
852
  if (editor === `windsurf` && windsurfIsAlreadyInstalled) {
1023
- p2.log.message(`
853
+ p.log.message(`
1024
854
  Windsurf is already installed, skipping.`);
1025
855
  return void 0;
1026
856
  }
1027
857
  if (editor === `vscode` && vscodeIsAlreadyInstalled) {
1028
- p2.log.message(`
858
+ p.log.message(`
1029
859
  VSCode is already installed, skipping.`);
1030
860
  return void 0;
1031
861
  }
1032
862
  if (editor === `cursor`) {
1033
- p2.log.message(
863
+ p.log.message(
1034
864
  `
1035
865
  Note: you will need to go into Cursor Settings -> MCP Settings and manually enable the installed Mastra MCP server.
1036
866
  `
1037
867
  );
1038
868
  }
1039
869
  if (editor === `cursor-global`) {
1040
- const confirm2 = await p2.select({
870
+ const confirm2 = await p.select({
1041
871
  message: `Global install will add/update ${cursorGlobalMCPConfigPath} and make the Mastra docs MCP server available in all your Cursor projects. Continue?`,
1042
872
  options: [
1043
873
  { value: "yes", label: "Yes, I understand" },
@@ -1049,7 +879,7 @@ Note: you will need to go into Cursor Settings -> MCP Settings and manually enab
1049
879
  }
1050
880
  }
1051
881
  if (editor === `windsurf`) {
1052
- const confirm2 = await p2.select({
882
+ const confirm2 = await p.select({
1053
883
  message: `Windsurf only supports a global MCP config (at ${windsurfGlobalMCPConfigPath}) is it ok to add/update that global config?
1054
884
  This means the Mastra docs MCP server will be available in all your Windsurf projects.`,
1055
885
  options: [
@@ -1066,7 +896,7 @@ This means the Mastra docs MCP server will be available in all your Windsurf pro
1066
896
  },
1067
897
  {
1068
898
  onCancel: () => {
1069
- p2.cancel("Operation cancelled.");
899
+ p.cancel("Operation cancelled.");
1070
900
  process.exit(0);
1071
901
  }
1072
902
  }
@@ -1075,25 +905,226 @@ This means the Mastra docs MCP server will be available in all your Windsurf pro
1075
905
  };
1076
906
  var checkForPkgJson = async () => {
1077
907
  const cwd = process.cwd();
1078
- const pkgJsonPath = path3.join(cwd, "package.json");
908
+ const pkgJsonPath = path.join(cwd, "package.json");
1079
909
  try {
1080
- await fs5.access(pkgJsonPath);
910
+ await fs4.access(pkgJsonPath);
1081
911
  } catch {
1082
- p2.log.error(
912
+ p.log.error(
1083
913
  'No package.json file found in the current directory. Please run "npm init -y" to create one, or run "npx create-mastra@latest" to create a new Mastra project.'
1084
914
  );
1085
915
  process.exit(1);
1086
916
  }
1087
917
  };
1088
918
 
1089
- // src/commands/init/init.ts
1090
- var s = p2.spinner();
919
+ // src/commands/utils.ts
920
+ function getPackageManager() {
921
+ const userAgent = process.env.npm_config_user_agent || "";
922
+ const execPath = process.env.npm_execpath || "";
923
+ if (userAgent.includes("yarn")) {
924
+ return "yarn";
925
+ }
926
+ if (userAgent.includes("pnpm")) {
927
+ return "pnpm";
928
+ }
929
+ if (userAgent.includes("npm")) {
930
+ return "npm";
931
+ }
932
+ if (execPath.includes("yarn")) {
933
+ return "yarn";
934
+ }
935
+ if (execPath.includes("pnpm")) {
936
+ return "pnpm";
937
+ }
938
+ if (execPath.includes("npm")) {
939
+ return "npm";
940
+ }
941
+ return "npm";
942
+ }
943
+ function parseMcp(value) {
944
+ if (!isValidEditor(value)) {
945
+ throw new InvalidArgumentError(`Choose a valid value: ${EDITOR.join(", ")}`);
946
+ }
947
+ return value;
948
+ }
949
+ function parseComponents(value) {
950
+ const parsedValue = value.split(",");
951
+ if (!areValidComponents(parsedValue)) {
952
+ throw new InvalidArgumentError(`Choose valid components: ${COMPONENTS.join(", ")}`);
953
+ }
954
+ return parsedValue;
955
+ }
956
+ function parseLlmProvider(value) {
957
+ if (!isValidLLMProvider(value)) {
958
+ throw new InvalidArgumentError(`Choose a valid provider: ${LLMProvider.join(", ")}`);
959
+ }
960
+ return value;
961
+ }
962
+ var logger = createLogger(false);
963
+ function createLogger(debug = false) {
964
+ return new PinoLogger({
965
+ name: "Mastra CLI",
966
+ level: debug ? "debug" : "info"
967
+ });
968
+ }
969
+
970
+ // src/utils/clone-template.ts
971
+ var exec2 = util.promisify(child_process.exec);
972
+ async function cloneTemplate(options) {
973
+ const { template, projectName, targetDir } = options;
974
+ const projectPath = targetDir ? path.resolve(targetDir, projectName) : path.resolve(projectName);
975
+ const spinner5 = yoctoSpinner2({ text: `Cloning template "${template.title}"...` }).start();
976
+ try {
977
+ if (await directoryExists(projectPath)) {
978
+ spinner5.error(`Directory ${projectName} already exists`);
979
+ throw new Error(`Directory ${projectName} already exists`);
980
+ }
981
+ await cloneRepositoryWithoutGit(template.githubUrl, projectPath);
982
+ await updatePackageJson(projectPath, projectName);
983
+ const envExamplePath = path.join(projectPath, ".env.example");
984
+ if (await fileExists(envExamplePath)) {
985
+ await fs4.copyFile(envExamplePath, path.join(projectPath, ".env"));
986
+ }
987
+ spinner5.success(`Template "${template.title}" cloned successfully to ${projectName}`);
988
+ return projectPath;
989
+ } catch (error) {
990
+ spinner5.error(`Failed to clone template: ${error instanceof Error ? error.message : "Unknown error"}`);
991
+ throw error;
992
+ }
993
+ }
994
+ async function directoryExists(dirPath) {
995
+ try {
996
+ const stat = await fs4.stat(dirPath);
997
+ return stat.isDirectory();
998
+ } catch {
999
+ return false;
1000
+ }
1001
+ }
1002
+ async function fileExists(filePath) {
1003
+ try {
1004
+ const stat = await fs4.stat(filePath);
1005
+ return stat.isFile();
1006
+ } catch {
1007
+ return false;
1008
+ }
1009
+ }
1010
+ async function cloneRepositoryWithoutGit(repoUrl, targetPath) {
1011
+ await fs4.mkdir(targetPath, { recursive: true });
1012
+ try {
1013
+ const degitRepo = repoUrl.replace("https://github.com/", "");
1014
+ const degitCommand = shellQuote2.quote(["npx", "degit", degitRepo, targetPath]);
1015
+ await exec2(degitCommand, {
1016
+ cwd: process.cwd()
1017
+ });
1018
+ } catch {
1019
+ try {
1020
+ const gitCommand = shellQuote2.quote(["git", "clone", repoUrl, targetPath]);
1021
+ await exec2(gitCommand, {
1022
+ cwd: process.cwd()
1023
+ });
1024
+ const gitDir = path.join(targetPath, ".git");
1025
+ if (await directoryExists(gitDir)) {
1026
+ await fs4.rm(gitDir, { recursive: true, force: true });
1027
+ }
1028
+ } catch (gitError) {
1029
+ throw new Error(`Failed to clone repository: ${gitError instanceof Error ? gitError.message : "Unknown error"}`);
1030
+ }
1031
+ }
1032
+ }
1033
+ async function updatePackageJson(projectPath, projectName) {
1034
+ const packageJsonPath = path.join(projectPath, "package.json");
1035
+ try {
1036
+ const packageJsonContent = await fs4.readFile(packageJsonPath, "utf-8");
1037
+ const packageJson = JSON.parse(packageJsonContent);
1038
+ packageJson.name = projectName;
1039
+ await fs4.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
1040
+ } catch (error) {
1041
+ logger.warn(`Could not update package.json: ${error instanceof Error ? error.message : "Unknown error"}`);
1042
+ }
1043
+ }
1044
+ async function installDependencies(projectPath, packageManager) {
1045
+ const spinner5 = yoctoSpinner2({ text: "Installing dependencies..." }).start();
1046
+ try {
1047
+ const pm = packageManager || getPackageManager();
1048
+ const installCommand = shellQuote2.quote([pm, "install"]);
1049
+ await exec2(installCommand, {
1050
+ cwd: projectPath
1051
+ });
1052
+ spinner5.success("Dependencies installed successfully");
1053
+ } catch (error) {
1054
+ spinner5.error(`Failed to install dependencies: ${error instanceof Error ? error.message : "Unknown error"}`);
1055
+ throw error;
1056
+ }
1057
+ }
1058
+ var TEMPLATES_API_URL = process.env.MASTRA_TEMPLATES_API_URL || "https://mastra.ai/api/templates.json";
1059
+ async function loadTemplates() {
1060
+ try {
1061
+ const response = await fetch(TEMPLATES_API_URL);
1062
+ if (!response.ok) {
1063
+ throw new Error(`Failed to fetch templates: ${response.statusText}`);
1064
+ }
1065
+ const templates = await response.json();
1066
+ return templates;
1067
+ } catch (error) {
1068
+ console.error("Error loading templates:", error);
1069
+ throw new Error("Failed to load templates. Please check your internet connection and try again.");
1070
+ }
1071
+ }
1072
+ function pluralize(count, singular, plural) {
1073
+ return count === 1 ? singular : plural || `${singular}s`;
1074
+ }
1075
+ async function selectTemplate(templates) {
1076
+ const choices = templates.map((template) => {
1077
+ const parts = [];
1078
+ if (template.agents?.length) {
1079
+ parts.push(`${template.agents.length} ${pluralize(template.agents.length, "agent")}`);
1080
+ }
1081
+ if (template.tools?.length) {
1082
+ parts.push(`${template.tools.length} ${pluralize(template.tools.length, "tool")}`);
1083
+ }
1084
+ if (template.workflows?.length) {
1085
+ parts.push(`${template.workflows.length} ${pluralize(template.workflows.length, "workflow")}`);
1086
+ }
1087
+ if (template.mcp?.length) {
1088
+ parts.push(`${template.mcp.length} ${pluralize(template.mcp.length, "MCP server")}`);
1089
+ }
1090
+ if (template.networks?.length) {
1091
+ parts.push(`${template.networks.length} ${pluralize(template.networks.length, "agent network")}`);
1092
+ }
1093
+ return {
1094
+ value: template,
1095
+ label: template.title,
1096
+ hint: parts.join(", ") || "Template components"
1097
+ };
1098
+ });
1099
+ const selected = await p.select({
1100
+ message: "Select a template:",
1101
+ options: choices
1102
+ });
1103
+ if (p.isCancel(selected)) {
1104
+ return null;
1105
+ }
1106
+ return selected;
1107
+ }
1108
+ function findTemplateByName(templates, templateName) {
1109
+ let template = templates.find((t) => t.slug === templateName);
1110
+ if (template) return template;
1111
+ const slugWithPrefix = `template-${templateName}`;
1112
+ template = templates.find((t) => t.slug === slugWithPrefix);
1113
+ if (template) return template;
1114
+ template = templates.find((t) => t.title.toLowerCase() === templateName.toLowerCase());
1115
+ if (template) return template;
1116
+ return null;
1117
+ }
1118
+ function getDefaultProjectName(template) {
1119
+ return template.slug.replace(/^template-/, "");
1120
+ }
1121
+ var s = p.spinner();
1091
1122
  var init = async ({
1092
- directory,
1093
- addExample = false,
1123
+ directory = "src/",
1094
1124
  components,
1095
1125
  llmProvider = "openai",
1096
1126
  llmApiKey,
1127
+ addExample = false,
1097
1128
  configureEditorWithDocsMCP
1098
1129
  }) => {
1099
1130
  s.start("Initializing Mastra");
@@ -1143,14 +1174,14 @@ var init = async ({
1143
1174
  }
1144
1175
  s.stop();
1145
1176
  if (!llmApiKey) {
1146
- p2.note(`
1177
+ p.note(`
1147
1178
  ${color2.green("Mastra initialized successfully!")}
1148
1179
 
1149
1180
  Add your ${color2.cyan(key)} as an environment variable
1150
1181
  in your ${color2.cyan(".env")} file
1151
1182
  `);
1152
1183
  } else {
1153
- p2.note(`
1184
+ p.note(`
1154
1185
  ${color2.green("Mastra initialized successfully!")}
1155
1186
  `);
1156
1187
  }
@@ -1217,20 +1248,20 @@ var createMastraProject = async ({
1217
1248
  llmApiKey,
1218
1249
  needsInteractive
1219
1250
  }) => {
1220
- p2.intro(color2.inverse(" Mastra Create "));
1221
- const projectName = name ?? await p2.text({
1251
+ p.intro(color2.inverse(" Mastra Create "));
1252
+ const projectName = name ?? await p.text({
1222
1253
  message: "What do you want to name your project?",
1223
1254
  placeholder: "my-mastra-app",
1224
1255
  defaultValue: "my-mastra-app",
1225
1256
  validate: (value) => {
1226
1257
  if (value.length === 0) return "Project name cannot be empty";
1227
- if (fs4__default.existsSync(value)) {
1258
+ if (fs3__default.existsSync(value)) {
1228
1259
  return `A directory named "${value}" already exists. Please choose a different name.`;
1229
1260
  }
1230
1261
  }
1231
1262
  });
1232
- if (p2.isCancel(projectName)) {
1233
- p2.cancel("Operation cancelled");
1263
+ if (p.isCancel(projectName)) {
1264
+ p.cancel("Operation cancelled");
1234
1265
  process.exit(0);
1235
1266
  }
1236
1267
  let result;
@@ -1240,11 +1271,11 @@ var createMastraProject = async ({
1240
1271
  skip: { llmProvider: llmProvider !== void 0, llmApiKey: llmApiKey !== void 0 }
1241
1272
  });
1242
1273
  }
1243
- const s2 = p2.spinner();
1274
+ const s2 = p.spinner();
1244
1275
  try {
1245
1276
  s2.start("Creating project");
1246
1277
  try {
1247
- await fs5.mkdir(projectName);
1278
+ await fs4.mkdir(projectName);
1248
1279
  } catch (error) {
1249
1280
  if (error instanceof Error && "code" in error && error.code === "EEXIST") {
1250
1281
  s2.stop(`A directory named "${projectName}" already exists. Please choose a different name.`);
@@ -1276,7 +1307,7 @@ var createMastraProject = async ({
1276
1307
  s2.stop("Project structure created");
1277
1308
  s2.start(`Installing ${pm} dependencies`);
1278
1309
  try {
1279
- await exec3(`${pm} ${installCommand} zod@^3`);
1310
+ await exec3(`${pm} ${installCommand} zod@^4`);
1280
1311
  await exec3(`${pm} ${installCommand} typescript @types/node --save-dev`);
1281
1312
  await exec3(`echo '{
1282
1313
  "compilerOptions": {
@@ -1333,13 +1364,13 @@ var createMastraProject = async ({
1333
1364
  throw new Error(`Failed to create .gitignore: ${error instanceof Error ? error.message : "Unknown error"}`);
1334
1365
  }
1335
1366
  s2.stop(".gitignore added");
1336
- p2.outro("Project created successfully");
1367
+ p.outro("Project created successfully");
1337
1368
  console.info("");
1338
1369
  return { projectName, result };
1339
1370
  } catch (error) {
1340
1371
  s2.stop();
1341
1372
  const errorMessage = error instanceof Error ? error.message : "An unexpected error occurred";
1342
- p2.cancel(`Project creation failed: ${errorMessage}`);
1373
+ p.cancel(`Project creation failed: ${errorMessage}`);
1343
1374
  process.exit(1);
1344
1375
  }
1345
1376
  };
@@ -1397,7 +1428,7 @@ var create = async (args2) => {
1397
1428
  };
1398
1429
  var postCreate = ({ projectName }) => {
1399
1430
  const packageManager = getPackageManager();
1400
- p2.outro(`
1431
+ p.outro(`
1401
1432
  ${color2.green("To start your project:")}
1402
1433
 
1403
1434
  ${color2.cyan("cd")} ${projectName}
@@ -1488,19 +1519,19 @@ async function createFromTemplate(args2) {
1488
1519
  const templates = await loadTemplates();
1489
1520
  const selected = await selectTemplate(templates);
1490
1521
  if (!selected) {
1491
- p2.log.info("No template selected. Exiting.");
1522
+ p.log.info("No template selected. Exiting.");
1492
1523
  return;
1493
1524
  }
1494
1525
  selectedTemplate = selected;
1495
1526
  } else if (args2.template && typeof args2.template === "string") {
1496
1527
  if (isGitHubUrl(args2.template)) {
1497
- const spinner5 = p2.spinner();
1528
+ const spinner5 = p.spinner();
1498
1529
  spinner5.start("Validating GitHub repository...");
1499
1530
  const validation = await validateGitHubProject(args2.template);
1500
1531
  if (!validation.isValid) {
1501
1532
  spinner5.stop("Validation failed");
1502
- p2.log.error("This does not appear to be a valid Mastra project:");
1503
- validation.errors.forEach((error) => p2.log.error(` - ${error}`));
1533
+ p.log.error("This does not appear to be a valid Mastra project:");
1534
+ validation.errors.forEach((error) => p.log.error(` - ${error}`));
1504
1535
  throw new Error("Invalid Mastra project");
1505
1536
  }
1506
1537
  spinner5.stop("Valid Mastra project \u2713");
@@ -1509,8 +1540,8 @@ async function createFromTemplate(args2) {
1509
1540
  const templates = await loadTemplates();
1510
1541
  const found = findTemplateByName(templates, args2.template);
1511
1542
  if (!found) {
1512
- p2.log.error(`Template "${args2.template}" not found. Available templates:`);
1513
- templates.forEach((t) => p2.log.info(` - ${t.title} (use: ${t.slug.replace("template-", "")})`));
1543
+ p.log.error(`Template "${args2.template}" not found. Available templates:`);
1544
+ templates.forEach((t) => p.log.info(` - ${t.title} (use: ${t.slug.replace("template-", "")})`));
1514
1545
  throw new Error(`Template "${args2.template}" not found`);
1515
1546
  }
1516
1547
  selectedTemplate = found;
@@ -1522,13 +1553,13 @@ async function createFromTemplate(args2) {
1522
1553
  let projectName = args2.projectName;
1523
1554
  if (!projectName) {
1524
1555
  const defaultName = getDefaultProjectName(selectedTemplate);
1525
- const response = await p2.text({
1556
+ const response = await p.text({
1526
1557
  message: "What is your project name?",
1527
1558
  defaultValue: defaultName,
1528
1559
  placeholder: defaultName
1529
1560
  });
1530
- if (p2.isCancel(response)) {
1531
- p2.log.info("Project creation cancelled.");
1561
+ if (p.isCancel(response)) {
1562
+ p.log.info("Project creation cancelled.");
1532
1563
  return;
1533
1564
  }
1534
1565
  projectName = response;
@@ -1546,7 +1577,7 @@ async function createFromTemplate(args2) {
1546
1577
  projectName
1547
1578
  });
1548
1579
  await installDependencies(projectPath);
1549
- p2.note(`
1580
+ p.note(`
1550
1581
  ${color2.green("Mastra template installed!")}
1551
1582
 
1552
1583
  Add the necessary environment
@@ -1554,11 +1585,11 @@ async function createFromTemplate(args2) {
1554
1585
  `);
1555
1586
  postCreate({ projectName });
1556
1587
  } catch (error) {
1557
- p2.log.error(`Failed to create project from template: ${error instanceof Error ? error.message : "Unknown error"}`);
1588
+ p.log.error(`Failed to create project from template: ${error instanceof Error ? error.message : "Unknown error"}`);
1558
1589
  throw error;
1559
1590
  }
1560
1591
  }
1561
1592
 
1562
- export { DepsService, FileService, checkAndInstallCoreDeps, checkForPkgJson, create, createLogger, init, interactivePrompt, logger };
1563
- //# sourceMappingURL=chunk-GK64AJRT.js.map
1564
- //# sourceMappingURL=chunk-GK64AJRT.js.map
1593
+ export { COMPONENTS, DepsService, FileService, LLMProvider, checkAndInstallCoreDeps, checkForPkgJson, create, createLogger, init, interactivePrompt, logger, parseComponents, parseLlmProvider, parseMcp };
1594
+ //# sourceMappingURL=chunk-H4ZSDLAG.js.map
1595
+ //# sourceMappingURL=chunk-H4ZSDLAG.js.map