mastra 0.16.0-alpha.1 → 0.17.0-alpha.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.
- package/CHANGELOG.md +57 -0
- package/dist/{chunk-GK64AJRT.js → chunk-H4ZSDLAG.js} +443 -412
- package/dist/chunk-H4ZSDLAG.js.map +1 -0
- package/dist/commands/actions/add-scorer.d.ts +3 -1
- package/dist/commands/actions/add-scorer.d.ts.map +1 -1
- package/dist/commands/actions/build-project.d.ts +6 -1
- package/dist/commands/actions/build-project.d.ts.map +1 -1
- package/dist/commands/actions/create-project.d.ts +16 -1
- package/dist/commands/actions/create-project.d.ts.map +1 -1
- package/dist/commands/actions/init-project.d.ts +13 -1
- package/dist/commands/actions/init-project.d.ts.map +1 -1
- package/dist/commands/actions/lint-project.d.ts +5 -1
- package/dist/commands/actions/lint-project.d.ts.map +1 -1
- package/dist/commands/actions/list-scorers.d.ts +1 -1
- package/dist/commands/actions/list-scorers.d.ts.map +1 -1
- package/dist/commands/actions/start-dev-server.d.ts +13 -1
- package/dist/commands/actions/start-dev-server.d.ts.map +1 -1
- package/dist/commands/actions/start-project.d.ts +5 -1
- package/dist/commands/actions/start-project.d.ts.map +1 -1
- package/dist/commands/build/build.d.ts +2 -3
- package/dist/commands/build/build.d.ts.map +1 -1
- package/dist/commands/create/create.d.ts +2 -1
- package/dist/commands/create/create.d.ts.map +1 -1
- package/dist/commands/create/create.js +1 -1
- package/dist/commands/dev/dev.d.ts +2 -3
- package/dist/commands/dev/dev.d.ts.map +1 -1
- package/dist/commands/init/init.d.ts +4 -4
- package/dist/commands/init/init.d.ts.map +1 -1
- package/dist/commands/init/mcp-docs-server-install.d.ts +12 -1
- package/dist/commands/init/mcp-docs-server-install.d.ts.map +1 -1
- package/dist/commands/init/utils.d.ts +12 -2
- package/dist/commands/init/utils.d.ts.map +1 -1
- package/dist/commands/utils.d.ts +3 -0
- package/dist/commands/utils.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -80
- package/dist/index.js.map +1 -1
- package/dist/playground/assets/{abap-BeVh9wYO.js → abap-VpVyeDq2.js} +1 -1
- package/dist/playground/assets/{abnf-bc6-zRBf.js → abnf-C_FuQNcZ.js} +1 -1
- package/dist/playground/assets/{actionscript-pHiBktI4.js → actionscript-C3XhU8Gp.js} +1 -1
- package/dist/playground/assets/{ada-DlqMzlgX.js → ada-BpXeRqNm.js} +1 -1
- package/dist/playground/assets/{agda-BFUhsrMT.js → agda-Drw0hYZY.js} +1 -1
- package/dist/playground/assets/{al-INk3pxPI.js → al-o-F6DQ2e.js} +1 -1
- package/dist/playground/assets/{antlr4-kAP5KEYn.js → antlr4-B2IvoZUT.js} +1 -1
- package/dist/playground/assets/{apacheconf-BOeH4NG7.js → apacheconf-BgEmCEA3.js} +1 -1
- package/dist/playground/assets/{apex-D6q20pyJ.js → apex-VQiddTkC.js} +1 -1
- package/dist/playground/assets/{apl-R9PgwjWx.js → apl-D3J6kgYQ.js} +1 -1
- package/dist/playground/assets/{applescript-xpKbRWNx.js → applescript-DXduvKeH.js} +1 -1
- package/dist/playground/assets/{aql-B4po4gKh.js → aql-CoO8GSHn.js} +1 -1
- package/dist/playground/assets/{arduino-CSW4W7a3.js → arduino-Da1MbUvx.js} +1 -1
- package/dist/playground/assets/{arff-CkcO4DdF.js → arff-BqbROG3v.js} +1 -1
- package/dist/playground/assets/{asciidoc-DhfiCxEg.js → asciidoc-CDv84C9z.js} +1 -1
- package/dist/playground/assets/{asm6502-CLUCCjqj.js → asm6502-CWDcoZv1.js} +1 -1
- package/dist/playground/assets/{asmatmel-C9VaW0TA.js → asmatmel-uBGWhhHQ.js} +1 -1
- package/dist/playground/assets/{aspnet-Cdd13xaq.js → aspnet-BXeFvXPI.js} +1 -1
- package/dist/playground/assets/{autohotkey-CdgCuO2Q.js → autohotkey-DfUf08H0.js} +1 -1
- package/dist/playground/assets/{autoit-DFOPUzSO.js → autoit-BZrbIvND.js} +1 -1
- package/dist/playground/assets/{avisynth-Bdia89Xe.js → avisynth-D-LqKSwl.js} +1 -1
- package/dist/playground/assets/{avro-idl-CnJPAewv.js → avro-idl-CL-j88oN.js} +1 -1
- package/dist/playground/assets/{bash-yDDkoNFa.js → bash-BWZC4Lzf.js} +1 -1
- package/dist/playground/assets/{basic-VANOpJci.js → basic-Cxoo8EnY.js} +1 -1
- package/dist/playground/assets/{batch-CDoii6MZ.js → batch-Hdjmngde.js} +1 -1
- package/dist/playground/assets/{bbcode-CZS3ESoo.js → bbcode-D8UCGDsA.js} +1 -1
- package/dist/playground/assets/{bicep-CZJOmbZ6.js → bicep-zRKsJAnq.js} +1 -1
- package/dist/playground/assets/{birb-CU1tWhC_.js → birb-BsLIRsqi.js} +1 -1
- package/dist/playground/assets/{bison-DBGGThIu.js → bison-DegSId9A.js} +1 -1
- package/dist/playground/assets/{bnf-DKBzDIfO.js → bnf-CSuqK8NF.js} +1 -1
- package/dist/playground/assets/{brainfuck-Aq6YF_5u.js → brainfuck-DCjM32xR.js} +1 -1
- package/dist/playground/assets/{brightscript-CH-vfh9S.js → brightscript-CK45j3OY.js} +1 -1
- package/dist/playground/assets/{bro-BfxaKX_p.js → bro-CkGLH0tm.js} +1 -1
- package/dist/playground/assets/{bsl-UGTI_hDL.js → bsl-3FAcHIlr.js} +1 -1
- package/dist/playground/assets/{c-BMxj2Tyh.js → c-BUNdGPuh.js} +1 -1
- package/dist/playground/assets/{cfscript-D6fJCg08.js → cfscript-Dt_xeDLb.js} +1 -1
- package/dist/playground/assets/{chaiscript-BCheiFLf.js → chaiscript-Yc1rKAd2.js} +1 -1
- package/dist/playground/assets/{cil-BVih9k7R.js → cil-Krjyp-97.js} +1 -1
- package/dist/playground/assets/{clike-DhFXulhW.js → clike-o4HcRp5p.js} +1 -1
- package/dist/playground/assets/{clojure-CLiU7PJY.js → clojure-DSr2y_6z.js} +1 -1
- package/dist/playground/assets/{cmake-Cn8H3Be_.js → cmake-CHOaq56P.js} +1 -1
- package/dist/playground/assets/{cobol-CdJvU9V7.js → cobol-C0dsrq0_.js} +1 -1
- package/dist/playground/assets/{coffeescript-DAoRk3OH.js → coffeescript-Cn72KcjR.js} +1 -1
- package/dist/playground/assets/{concurnas-BB4Mo4-a.js → concurnas-CTfs2m00.js} +1 -1
- package/dist/playground/assets/{coq-BdSVWrQC.js → coq-Z0C80uzD.js} +1 -1
- package/dist/playground/assets/{core-_CW086h8.js → core-C3gVd0nG.js} +1 -1
- package/dist/playground/assets/{cpp-jazXWyhl.js → cpp-Noek48Ct.js} +1 -1
- package/dist/playground/assets/{crystal-C6sZzoQs.js → crystal-C5a6t153.js} +1 -1
- package/dist/playground/assets/{csharp-E5LEJ_Dh.js → csharp-JJYMCRkp.js} +1 -1
- package/dist/playground/assets/{cshtml-ZItlVSDW.js → cshtml-DwnhRUxD.js} +1 -1
- package/dist/playground/assets/{csp-D2cRXZqo.js → csp-Do_T2Prv.js} +1 -1
- package/dist/playground/assets/{css-BFBZCEaG.js → css-DqEKPO8M.js} +1 -1
- package/dist/playground/assets/{css-extras-BCidnJcx.js → css-extras-wuG2JGtV.js} +1 -1
- package/dist/playground/assets/{csv-CHVe0ypk.js → csv-D-IggZSv.js} +1 -1
- package/dist/playground/assets/{cypher-D7UY7Xq0.js → cypher-DztCFv0p.js} +1 -1
- package/dist/playground/assets/{d-KYHDwIB7.js → d-xphkzGQg.js} +1 -1
- package/dist/playground/assets/{dart-5pEwPiAn.js → dart-s364744Q.js} +1 -1
- package/dist/playground/assets/{dataweave-2A9x7JBV.js → dataweave-BrbCqIFp.js} +1 -1
- package/dist/playground/assets/{dax-B5F6LTt0.js → dax-lzpGrM2w.js} +1 -1
- package/dist/playground/assets/{dhall-CIJUzRlp.js → dhall-CwlRR5Qn.js} +1 -1
- package/dist/playground/assets/{diff-D6Wl9krM.js → diff-Bz1g1Hqw.js} +1 -1
- package/dist/playground/assets/{django-BB0PUsOM.js → django-Cf6DRNlK.js} +1 -1
- package/dist/playground/assets/{dns-zone-file-DUwY_2F2.js → dns-zone-file-DSVcL1MN.js} +1 -1
- package/dist/playground/assets/{docker-CMx9_iSG.js → docker-C1mfhGkn.js} +1 -1
- package/dist/playground/assets/{dot-kbMAsqX7.js → dot-BCX7FdGJ.js} +1 -1
- package/dist/playground/assets/{ebnf-ebYDd0sk.js → ebnf-CAMSMnwD.js} +1 -1
- package/dist/playground/assets/{editorconfig-D-vaGu6j.js → editorconfig-DzF_jRd8.js} +1 -1
- package/dist/playground/assets/{eiffel-BxvSLMmD.js → eiffel-C3nK6tH6.js} +1 -1
- package/dist/playground/assets/{ejs-Z8ViVb8a.js → ejs-DKz7xzte.js} +1 -1
- package/dist/playground/assets/{elixir-Bu2vTUUv.js → elixir-BoKHRrfK.js} +1 -1
- package/dist/playground/assets/{elm-Dx1u8KX9.js → elm-X6ikG-bI.js} +1 -1
- package/dist/playground/assets/{erb-B5spGQcx.js → erb-Ocsj3Hfy.js} +1 -1
- package/dist/playground/assets/{erlang-sBg4pIlZ.js → erlang-CkhdXZRT.js} +1 -1
- package/dist/playground/assets/{etlua-DIxVICdf.js → etlua-DjJI9rJC.js} +1 -1
- package/dist/playground/assets/{excel-formula-Ca9LI-7L.js → excel-formula-B50gPFGY.js} +1 -1
- package/dist/playground/assets/{factor-CLmTTBeZ.js → factor-BaqMs7OQ.js} +1 -1
- package/dist/playground/assets/{false-CJfyAx3h.js → false-CdXzS-Qz.js} +1 -1
- package/dist/playground/assets/{firestore-security-rules-D7RLQfET.js → firestore-security-rules-DOQNQupQ.js} +1 -1
- package/dist/playground/assets/{flow-D1rRV-C2.js → flow-BI0wecK5.js} +1 -1
- package/dist/playground/assets/{fortran-DA4FFCKs.js → fortran-D8gN_n97.js} +1 -1
- package/dist/playground/assets/{fsharp-Bsc0AZkI.js → fsharp-CXmYGCVi.js} +1 -1
- package/dist/playground/assets/{ftl-eQ3TUB0-.js → ftl-DFrWzc2F.js} +1 -1
- package/dist/playground/assets/{gap-BG8HpDy-.js → gap-azXoY9Lo.js} +1 -1
- package/dist/playground/assets/{gcode-CLDHUGPT.js → gcode-BvT4fkt9.js} +1 -1
- package/dist/playground/assets/{gdscript-DBuEendT.js → gdscript-CHDGPiTM.js} +1 -1
- package/dist/playground/assets/{gedcom-CokOCLjC.js → gedcom-DLQR-0eW.js} +1 -1
- package/dist/playground/assets/{gherkin-BrOY3WUa.js → gherkin-Bt7vNS6b.js} +1 -1
- package/dist/playground/assets/{git-C6WRIHFA.js → git-CpearmlZ.js} +1 -1
- package/dist/playground/assets/{glsl-DDIbdctQ.js → glsl-BgkyISs7.js} +1 -1
- package/dist/playground/assets/{gml-DQNpqqRD.js → gml-DxgB2vDp.js} +1 -1
- package/dist/playground/assets/{gn-DagNMSah.js → gn-0iUnjSCI.js} +1 -1
- package/dist/playground/assets/{go-wUV9ceel.js → go-Dnc4kDIH.js} +1 -1
- package/dist/playground/assets/{go-module-BiJnBaQg.js → go-module-DJ6_fCKK.js} +1 -1
- package/dist/playground/assets/{graphql-COT_xzaB.js → graphql-BKsDns1l.js} +1 -1
- package/dist/playground/assets/{groovy-DttoMMyd.js → groovy-CD4WnZGn.js} +1 -1
- package/dist/playground/assets/{haml-CeVyB6jn.js → haml-BaNjNTBj.js} +1 -1
- package/dist/playground/assets/{handlebars-D2_WbdmV.js → handlebars-C3EybPaM.js} +1 -1
- package/dist/playground/assets/{haskell-BL6lVmya.js → haskell-D0MyoDhD.js} +1 -1
- package/dist/playground/assets/{haxe-D2VIZe7V.js → haxe-BLI_YlGX.js} +1 -1
- package/dist/playground/assets/{hcl-BjDr52dg.js → hcl-CoXIuAMj.js} +1 -1
- package/dist/playground/assets/{hlsl-D-fQ8Wer.js → hlsl-DetZFZX2.js} +1 -1
- package/dist/playground/assets/{hoon-evUgU5ci.js → hoon-C6UQvqzZ.js} +1 -1
- package/dist/playground/assets/{hpkp-Dl3XSjpI.js → hpkp-DUXfFm2m.js} +1 -1
- package/dist/playground/assets/{hsts-DMnunA2S.js → hsts-Cx-0j44D.js} +1 -1
- package/dist/playground/assets/{http-BDbezoge.js → http-D2sC-AVF.js} +1 -1
- package/dist/playground/assets/{ichigojam-H-vpa6rN.js → ichigojam-CJ7lReO5.js} +1 -1
- package/dist/playground/assets/{icon-JH63V6er.js → icon-DyZSDGk-.js} +1 -1
- package/dist/playground/assets/{icu-message-format-DV8gn9NY.js → icu-message-format-DO42ZUvd.js} +1 -1
- package/dist/playground/assets/{idris-D4_01pEI.js → idris-BaZ-ul-C.js} +1 -1
- package/dist/playground/assets/{iecst-D4ucjg6m.js → iecst-Bt33Dfnh.js} +1 -1
- package/dist/playground/assets/{ignore-DIncI5_y.js → ignore-BmNbw9yL.js} +1 -1
- package/dist/playground/assets/{index-DYAHee2R.js → index-S2EsucGv.js} +1 -1
- package/dist/playground/assets/index-am8mDVF2.js +1061 -0
- package/dist/playground/assets/{inform7-CluasQqA.js → inform7-T-PQl4Y8.js} +1 -1
- package/dist/playground/assets/{ini-BDSiPm61.js → ini-BtMKtLvH.js} +1 -1
- package/dist/playground/assets/{io-BWOtIkv0.js → io-C6HS03Jb.js} +1 -1
- package/dist/playground/assets/{j-DHU_96rO.js → j-DlEvz4aw.js} +1 -1
- package/dist/playground/assets/{java-BGX5Qz_G.js → java-XFYYewkc.js} +1 -1
- package/dist/playground/assets/{javadoc-CrisBBvy.js → javadoc-DQbq8V36.js} +1 -1
- package/dist/playground/assets/{javadoclike-DsKbX_TE.js → javadoclike-DzpJiZL2.js} +1 -1
- package/dist/playground/assets/{javascript-pMkJ9TnX.js → javascript-CH0KTI-w.js} +1 -1
- package/dist/playground/assets/{javastacktrace-BDe7CAui.js → javastacktrace-D1DWL-6t.js} +1 -1
- package/dist/playground/assets/{jexl-6qvsm5K0.js → jexl-CSrXjxv-.js} +1 -1
- package/dist/playground/assets/{jolie-CsTQLHtr.js → jolie-B19_-fv1.js} +1 -1
- package/dist/playground/assets/{jq-qXtlr9ZB.js → jq-Be4VJFlF.js} +1 -1
- package/dist/playground/assets/{js-extras-Bdfkam9i.js → js-extras-BLHb3hrV.js} +1 -1
- package/dist/playground/assets/{js-templates-DuBPPypw.js → js-templates-BrnvK9zU.js} +1 -1
- package/dist/playground/assets/{jsdoc-D_s3XyYE.js → jsdoc-DfmI219t.js} +1 -1
- package/dist/playground/assets/{json-Drj7ag6x.js → json-Bjr367_O.js} +1 -1
- package/dist/playground/assets/{json5-CKbfZ2m-.js → json5-CA9o1Faa.js} +1 -1
- package/dist/playground/assets/{jsonp-D5pJuVtU.js → jsonp-tCG2DJ5s.js} +1 -1
- package/dist/playground/assets/{jsstacktrace-BTwBo2I7.js → jsstacktrace-B9rLusxh.js} +1 -1
- package/dist/playground/assets/{jsx-CsAaGFt-.js → jsx-DcbmAcIf.js} +1 -1
- package/dist/playground/assets/{julia-bMxZKAAH.js → julia-DHJm07ZK.js} +1 -1
- package/dist/playground/assets/{keepalived-B5zK3xPx.js → keepalived-DEq18gvv.js} +1 -1
- package/dist/playground/assets/{keyman-DJdJ8FU3.js → keyman-dsql1r0j.js} +1 -1
- package/dist/playground/assets/{kotlin-DSO5UI4a.js → kotlin-DPjqobbb.js} +1 -1
- package/dist/playground/assets/{kumir-Bc7JXabl.js → kumir-BzLiNniZ.js} +1 -1
- package/dist/playground/assets/{kusto-CekWY9HE.js → kusto-BgKl4nLI.js} +1 -1
- package/dist/playground/assets/{latex-BPa9NjOi.js → latex-6W2WkeSm.js} +1 -1
- package/dist/playground/assets/{latte-H8YfYxti.js → latte-CglMtwdD.js} +1 -1
- package/dist/playground/assets/{less-CMBJz-zr.js → less-DW5Lgaui.js} +1 -1
- package/dist/playground/assets/{lilypond-C9K2xp-J.js → lilypond-CAICi6OE.js} +1 -1
- package/dist/playground/assets/{liquid-imv9N8iU.js → liquid-DJ8uaew9.js} +1 -1
- package/dist/playground/assets/{lisp-BKejkINC.js → lisp-DZ9-4rBx.js} +1 -1
- package/dist/playground/assets/{livescript-BgjwYbTD.js → livescript-F2REdfVp.js} +1 -1
- package/dist/playground/assets/{llvm-DKbR_sHV.js → llvm-DcGgTbZW.js} +1 -1
- package/dist/playground/assets/{log-DQpomHLF.js → log-D7q9Ii7p.js} +1 -1
- package/dist/playground/assets/{lolcode-ByD2sy4O.js → lolcode-h7s8DH-s.js} +1 -1
- package/dist/playground/assets/{lua-7RpJWQcA.js → lua-B9KPiFAX.js} +1 -1
- package/dist/playground/assets/{magma-D6QrM_bi.js → magma-CisiOExf.js} +1 -1
- package/dist/playground/assets/{makefile-DwOLzIra.js → makefile-Boy85MPQ.js} +1 -1
- package/dist/playground/assets/{markdown-DRkB8bZ-.js → markdown-BZwwNKPM.js} +1 -1
- package/dist/playground/assets/{markup-CwLOI5_s.js → markup-BIJRGo4x.js} +1 -1
- package/dist/playground/assets/{markup-templating-BbgXhMmb.js → markup-templating-6ZLUg8vQ.js} +1 -1
- package/dist/playground/assets/{matlab-BWWJDLvM.js → matlab-DRc0uX9A.js} +1 -1
- package/dist/playground/assets/{maxscript-Bk65HfnH.js → maxscript-CiqqSyka.js} +1 -1
- package/dist/playground/assets/{mel-BlV1PMgZ.js → mel-JqQjDEoR.js} +1 -1
- package/dist/playground/assets/{mermaid-spZDb7FE.js → mermaid-BShs2ZUp.js} +1 -1
- package/dist/playground/assets/{mizar-08nMZjrP.js → mizar-BF8GP180.js} +1 -1
- package/dist/playground/assets/{mongodb-BnVg3UbX.js → mongodb-CNkYTayj.js} +1 -1
- package/dist/playground/assets/{monkey-CRpKwccu.js → monkey-D4krOf2k.js} +1 -1
- package/dist/playground/assets/{moonscript-BzdnPok6.js → moonscript-C4fdGfle.js} +1 -1
- package/dist/playground/assets/{n1ql-DZmVp6R_.js → n1ql-CrelA5rC.js} +1 -1
- package/dist/playground/assets/{n4js-sL02SVWk.js → n4js-dZmo0cJc.js} +1 -1
- package/dist/playground/assets/{nand2tetris-hdl-DKVCSp6b.js → nand2tetris-hdl-94XUY5QI.js} +1 -1
- package/dist/playground/assets/{naniscript-BTTsKhPU.js → naniscript-Cvx0PN2t.js} +1 -1
- package/dist/playground/assets/{nasm-D3GkTc2V.js → nasm-COaVNSB1.js} +1 -1
- package/dist/playground/assets/{neon-DogQL_p2.js → neon-CDQw2p6a.js} +1 -1
- package/dist/playground/assets/{nevod-CnHPr1Ml.js → nevod-CnY73_bO.js} +1 -1
- package/dist/playground/assets/{nginx-CHr9YSXh.js → nginx-BjtIyBCx.js} +1 -1
- package/dist/playground/assets/{nim-BfLV_TrH.js → nim-Bfs_nNa2.js} +1 -1
- package/dist/playground/assets/{nix-BdSkzbLY.js → nix-D4FOItwn.js} +1 -1
- package/dist/playground/assets/{nsis-CabA7aqN.js → nsis-CDx7F7hL.js} +1 -1
- package/dist/playground/assets/{objectivec-BbytJVwh.js → objectivec-CXShIBYr.js} +1 -1
- package/dist/playground/assets/{ocaml-DuAKwJTW.js → ocaml-DrwgqXOl.js} +1 -1
- package/dist/playground/assets/{opencl-CVwfb9m6.js → opencl-C5FcwZ_U.js} +1 -1
- package/dist/playground/assets/{openqasm-B1RmJZJM.js → openqasm-C_yV_Yhc.js} +1 -1
- package/dist/playground/assets/{oz-BRds7xws.js → oz-BCwwfzjH.js} +1 -1
- package/dist/playground/assets/{parigp-aKwbmZfe.js → parigp-CvA6EMPF.js} +1 -1
- package/dist/playground/assets/{parser-B4nYxiGi.js → parser-CzJ2nwUr.js} +1 -1
- package/dist/playground/assets/{pascal-fvdAvizw.js → pascal-JIn8eypV.js} +1 -1
- package/dist/playground/assets/{pascaligo-Dgd8-wAU.js → pascaligo-Cl0M8e9O.js} +1 -1
- package/dist/playground/assets/{pcaxis-CGfHRdK8.js → pcaxis-hGQDqEux.js} +1 -1
- package/dist/playground/assets/{peoplecode-CjQAQWA4.js → peoplecode-Phtv4cwA.js} +1 -1
- package/dist/playground/assets/{perl-DLz7_ETf.js → perl-C_Ec8MpF.js} +1 -1
- package/dist/playground/assets/{php-DW3xtft_.js → php-B3vNrode.js} +1 -1
- package/dist/playground/assets/{php-extras-C3tujuom.js → php-extras-DJrSCPGM.js} +1 -1
- package/dist/playground/assets/{phpdoc-Dwx5qUcW.js → phpdoc-CRCiPGtg.js} +1 -1
- package/dist/playground/assets/{plsql-IxxMebL2.js → plsql-FXTwasXU.js} +1 -1
- package/dist/playground/assets/{powerquery-Cm-kRFVv.js → powerquery-s5uyyNjT.js} +1 -1
- package/dist/playground/assets/{powershell-BbKqpZgB.js → powershell-BkzKhuf5.js} +1 -1
- package/dist/playground/assets/{processing-ClTvPQgI.js → processing-DA3o6Ty8.js} +1 -1
- package/dist/playground/assets/{prolog-4t6l26pC.js → prolog-BKokkpRI.js} +1 -1
- package/dist/playground/assets/{promql-BzxAkgEP.js → promql-DxEc5NJb.js} +1 -1
- package/dist/playground/assets/{properties-Do_adEt9.js → properties-iZEtzZKv.js} +1 -1
- package/dist/playground/assets/{protobuf-BMu4qteV.js → protobuf-CUnuOTE6.js} +1 -1
- package/dist/playground/assets/{psl-DhK_zZFE.js → psl-CMHiUou0.js} +1 -1
- package/dist/playground/assets/{pug-D6u54t0o.js → pug-DEpeDWIA.js} +1 -1
- package/dist/playground/assets/{puppet-B2VtngUT.js → puppet-B-oUxTCI.js} +1 -1
- package/dist/playground/assets/{pure-BGHW50o9.js → pure-BtzHyX42.js} +1 -1
- package/dist/playground/assets/{purebasic-BEVT_NtP.js → purebasic-CbEqly3a.js} +1 -1
- package/dist/playground/assets/{purescript-B_2XNZmo.js → purescript-BuR21UsZ.js} +1 -1
- package/dist/playground/assets/{python-DsOV0ZxY.js → python-C0UnJiNs.js} +1 -1
- package/dist/playground/assets/{q-DaBl6Tn9.js → q-ByF3ebz9.js} +1 -1
- package/dist/playground/assets/{qml-C6-s5iRC.js → qml-BrctpvPn.js} +1 -1
- package/dist/playground/assets/{qore-DDbySqFZ.js → qore-DgwuAky0.js} +1 -1
- package/dist/playground/assets/{qsharp-D6gHiRyA.js → qsharp-D0GNxX-R.js} +1 -1
- package/dist/playground/assets/{r-DfN8wHkH.js → r-COJ5RCzD.js} +1 -1
- package/dist/playground/assets/{racket-BD3rm2uQ.js → racket-CwlQGMaI.js} +1 -1
- package/dist/playground/assets/{reason-C0OgfHev.js → reason-7EfqU5J9.js} +1 -1
- package/dist/playground/assets/{regex-CwRHu-qf.js → regex-tNdlhkFB.js} +1 -1
- package/dist/playground/assets/{rego-CIDysNoZ.js → rego-CDroqHyn.js} +1 -1
- package/dist/playground/assets/{renpy-gGnAZobJ.js → renpy-pkUobVx-.js} +1 -1
- package/dist/playground/assets/{rest-BWbZe4fM.js → rest-Bf89LEwH.js} +1 -1
- package/dist/playground/assets/{rip-B-6CLTEZ.js → rip-CnBO8xeH.js} +1 -1
- package/dist/playground/assets/{roboconf-bfiwMI_z.js → roboconf-D8lY4hLp.js} +1 -1
- package/dist/playground/assets/{robotframework-BEWF3d6M.js → robotframework-C7VQwQlQ.js} +1 -1
- package/dist/playground/assets/{ruby-BZHM-l1c.js → ruby-BBGr4WXw.js} +1 -1
- package/dist/playground/assets/{rust-B4MbAIK2.js → rust-Cv_yMsna.js} +1 -1
- package/dist/playground/assets/{sas-BgTju6ie.js → sas-BefoVmTk.js} +1 -1
- package/dist/playground/assets/{sass-DmxKqTPW.js → sass-FpTZa_UJ.js} +1 -1
- package/dist/playground/assets/{scala-DO1tcH4S.js → scala-BFo7PYuM.js} +1 -1
- package/dist/playground/assets/{scheme-CTN8O8h3.js → scheme-DUMNHkPf.js} +1 -1
- package/dist/playground/assets/{scss-C7_g7ZUN.js → scss-Bt0oT4tM.js} +1 -1
- package/dist/playground/assets/{shell-session-CYuWdWUa.js → shell-session-D9j3FvGI.js} +1 -1
- package/dist/playground/assets/{smali-BMdf76M3.js → smali-DAiHzOzy.js} +1 -1
- package/dist/playground/assets/{smalltalk-CqnUnhnK.js → smalltalk-Cb2wZjp-.js} +1 -1
- package/dist/playground/assets/{smarty-C16vBj9e.js → smarty-CHwQcR8y.js} +1 -1
- package/dist/playground/assets/{sml-DsRtcMBb.js → sml-BkB_3aX6.js} +1 -1
- package/dist/playground/assets/{solidity-C4VR-uAi.js → solidity-B-AYRn75.js} +1 -1
- package/dist/playground/assets/{solution-file-54OIUEFV.js → solution-file-BZCTLJ8E.js} +1 -1
- package/dist/playground/assets/{soy-BN_0aSaf.js → soy-DVlXUrIk.js} +1 -1
- package/dist/playground/assets/{sparql-0HNFG_LO.js → sparql-DYBMhyLG.js} +1 -1
- package/dist/playground/assets/{splunk-spl-BshoDF6X.js → splunk-spl-D6pJ76zI.js} +1 -1
- package/dist/playground/assets/{sqf-in6AW-6g.js → sqf-B3BvZAXF.js} +1 -1
- package/dist/playground/assets/{sql-Cx68n1WT.js → sql-OxDLYC24.js} +1 -1
- package/dist/playground/assets/{squirrel-BLvosXX5.js → squirrel-DPuntqLi.js} +1 -1
- package/dist/playground/assets/{stan-C4FRtvbb.js → stan-Cga860om.js} +1 -1
- package/dist/playground/assets/{stylus-CdjcxVsh.js → stylus-CD9I3ec0.js} +1 -1
- package/dist/playground/assets/{swift-CrnfwH-_.js → swift-DLJ-4tGG.js} +1 -1
- package/dist/playground/assets/{systemd-CqFXrTw0.js → systemd-C7BRKoLp.js} +1 -1
- package/dist/playground/assets/{t4-cs-4lbo24Gk.js → t4-cs-BGyN3PzZ.js} +1 -1
- package/dist/playground/assets/{t4-templating-DCUWL9S2.js → t4-templating-DaBQuSvH.js} +1 -1
- package/dist/playground/assets/{t4-vb-CT_9VyNP.js → t4-vb-C7VCIvbF.js} +1 -1
- package/dist/playground/assets/{tap-jpQRQYDR.js → tap-Ce8cos8W.js} +1 -1
- package/dist/playground/assets/{tcl-BAq5hu1g.js → tcl-aYMzqC1i.js} +1 -1
- package/dist/playground/assets/{textile-DACOdKkk.js → textile-CVc321Og.js} +1 -1
- package/dist/playground/assets/{toml-CrAxnvu3.js → toml-DKnowQgs.js} +1 -1
- package/dist/playground/assets/{tremor-S0FYfXp4.js → tremor-CWn59I5W.js} +1 -1
- package/dist/playground/assets/{tsx-JEf1Jz4Q.js → tsx-DOEV7jSC.js} +1 -1
- package/dist/playground/assets/{tt2-CnHGXHXh.js → tt2-DbV4GYoA.js} +1 -1
- package/dist/playground/assets/{turtle-tbyHfZ8d.js → turtle-BJTCS26D.js} +1 -1
- package/dist/playground/assets/{twig-BA_0IMhb.js → twig-CscwsMwI.js} +1 -1
- package/dist/playground/assets/{typescript-DPJm1p2Z.js → typescript-Mw6TOtOD.js} +1 -1
- package/dist/playground/assets/{typoscript-Bdpc5Oxs.js → typoscript-yvBOege3.js} +1 -1
- package/dist/playground/assets/{unrealscript-6jIWtm7n.js → unrealscript-37hKl-r5.js} +1 -1
- package/dist/playground/assets/{uorazor-BOEaf2xT.js → uorazor-DDgBT9Av.js} +1 -1
- package/dist/playground/assets/{uri-DU408NbV.js → uri-CcO-DUpY.js} +1 -1
- package/dist/playground/assets/{v-0BSYWUJO.js → v-B5FYQFQw.js} +1 -1
- package/dist/playground/assets/{vala-LdQfScnG.js → vala-SGktv3bh.js} +1 -1
- package/dist/playground/assets/{vbnet-CrQC2PTx.js → vbnet-BBmHgeeV.js} +1 -1
- package/dist/playground/assets/{velocity-DF683JjC.js → velocity-CDAXJ-4L.js} +1 -1
- package/dist/playground/assets/{verilog-CFCnJ5V1.js → verilog-CTZrGURj.js} +1 -1
- package/dist/playground/assets/{vhdl-D-XdeEl1.js → vhdl-CqUI9V-s.js} +1 -1
- package/dist/playground/assets/{vim-CdjqpykQ.js → vim-aCrahUVK.js} +1 -1
- package/dist/playground/assets/{visual-basic-CyO6M8Yn.js → visual-basic-uMyUwiHX.js} +1 -1
- package/dist/playground/assets/{warpscript-BqP6PVmh.js → warpscript-B3FwIrrc.js} +1 -1
- package/dist/playground/assets/{wasm-C33NIyKR.js → wasm-BhdYlZJN.js} +1 -1
- package/dist/playground/assets/{web-idl-gbc_RGVF.js → web-idl-OcmPAUMs.js} +1 -1
- package/dist/playground/assets/{wiki-76tnlQI5.js → wiki-Dgync4cN.js} +1 -1
- package/dist/playground/assets/{wolfram-9sWCTyDZ.js → wolfram-B3fJkmSv.js} +1 -1
- package/dist/playground/assets/{wren-D0Eeyo1v.js → wren-CiEMR5ii.js} +1 -1
- package/dist/playground/assets/{xeora-BGSd0LxL.js → xeora-CQs1FYZ7.js} +1 -1
- package/dist/playground/assets/{xml-doc-BzjM0M_Z.js → xml-doc-C9wqUHW8.js} +1 -1
- package/dist/playground/assets/{xojo-C9kAlVSu.js → xojo-4Eo1X1wd.js} +1 -1
- package/dist/playground/assets/{xquery-CNrYbVsf.js → xquery-DdqUerwM.js} +1 -1
- package/dist/playground/assets/{yaml-Cs7l_osE.js → yaml-BCtdvt9Y.js} +1 -1
- package/dist/playground/assets/{yang-DVQNXSWo.js → yang-il6SZfEf.js} +1 -1
- package/dist/playground/assets/{zig-OWOZw6E5.js → zig-C4UYtwNw.js} +1 -1
- package/dist/playground/index.html +1 -1
- package/package.json +7 -10
- package/dist/chunk-GK64AJRT.js.map +0 -1
- package/dist/commands/actions/deploy-project.d.ts +0 -2
- package/dist/commands/actions/deploy-project.d.ts.map +0 -1
- package/dist/commands/deploy/index.d.ts +0 -4
- package/dist/commands/deploy/index.d.ts.map +0 -1
- package/dist/playground/assets/index-D37DDP_2.js +0 -1070
|
@@ -1,203 +1,137 @@
|
|
|
1
1
|
import { getAnalytics } from './chunk-OQQFOUQW.js';
|
|
2
|
-
import * as
|
|
2
|
+
import * as p from '@clack/prompts';
|
|
3
3
|
import color2 from 'picocolors';
|
|
4
|
-
import
|
|
4
|
+
import fs4 from 'fs/promises';
|
|
5
5
|
import child_process from 'child_process';
|
|
6
6
|
import util from 'util';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import * as
|
|
12
|
-
import
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
|
56
|
+
return {
|
|
57
|
+
...original,
|
|
58
|
+
mcpServers: {
|
|
59
|
+
...original?.mcpServers || {},
|
|
60
|
+
...createMcpConfig(editor).mcpServers
|
|
61
|
+
}
|
|
62
|
+
};
|
|
42
63
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
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 (
|
|
162
|
+
if (fs3__default.existsSync(path.join(dir, file))) {
|
|
229
163
|
return file;
|
|
230
164
|
}
|
|
231
165
|
}
|
|
232
|
-
const parentDir =
|
|
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
|
-
|
|
366
|
-
|
|
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
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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
|
-
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
492
|
-
const filePath =
|
|
493
|
-
const fileString =
|
|
494
|
-
if (
|
|
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 =
|
|
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 (
|
|
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 =
|
|
341
|
+
let fileContent = fs3__default.readFileSync(filePath, "utf8");
|
|
520
342
|
replacements.forEach(({ search, replace }) => {
|
|
521
343
|
fileContent = fileContent.replaceAll(search, replace);
|
|
522
344
|
});
|
|
523
|
-
|
|
345
|
+
fs3__default.writeFileSync(filePath, fileContent);
|
|
524
346
|
}
|
|
525
347
|
};
|
|
526
348
|
|
|
527
349
|
// src/commands/init/utils.ts
|
|
528
|
-
var
|
|
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
|
|
583
|
-
await
|
|
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
|
|
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 =
|
|
635
|
+
const destPath = path.join(indexPath);
|
|
806
636
|
try {
|
|
807
|
-
await
|
|
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
|
|
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
|
|
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", "^
|
|
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 =
|
|
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
|
|
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 (
|
|
882
|
-
|
|
711
|
+
if (p.isCancel(confirm2)) {
|
|
712
|
+
p.cancel("Installation Cancelled");
|
|
883
713
|
process.exit(0);
|
|
884
714
|
}
|
|
885
715
|
if (!confirm2) {
|
|
886
|
-
|
|
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 =
|
|
923
|
-
const escapedApiKey =
|
|
924
|
-
await
|
|
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 =
|
|
758
|
+
const dirPath = path.join(process.cwd(), ...dir, "mastra");
|
|
929
759
|
try {
|
|
930
|
-
await
|
|
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
|
-
|
|
786
|
+
p.intro(color2.inverse(" Mastra Init "));
|
|
957
787
|
}
|
|
958
|
-
const mastraProject = await
|
|
788
|
+
const mastraProject = await p.group(
|
|
959
789
|
{
|
|
960
|
-
directory: () =>
|
|
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 :
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
858
|
+
p.log.message(`
|
|
1029
859
|
VSCode is already installed, skipping.`);
|
|
1030
860
|
return void 0;
|
|
1031
861
|
}
|
|
1032
862
|
if (editor === `cursor`) {
|
|
1033
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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 =
|
|
908
|
+
const pkgJsonPath = path.join(cwd, "package.json");
|
|
1079
909
|
try {
|
|
1080
|
-
await
|
|
910
|
+
await fs4.access(pkgJsonPath);
|
|
1081
911
|
} catch {
|
|
1082
|
-
|
|
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/
|
|
1090
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1221
|
-
const projectName = name ?? await
|
|
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 (
|
|
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 (
|
|
1233
|
-
|
|
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 =
|
|
1274
|
+
const s2 = p.spinner();
|
|
1244
1275
|
try {
|
|
1245
1276
|
s2.start("Creating project");
|
|
1246
1277
|
try {
|
|
1247
|
-
await
|
|
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@^
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
1503
|
-
validation.errors.forEach((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
|
-
|
|
1513
|
-
templates.forEach((t) =>
|
|
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
|
|
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 (
|
|
1531
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
1564
|
-
//# sourceMappingURL=chunk-
|
|
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
|