From b08fc4229fa5fdffe55a4e1d23a95485c2c8a4b3 Mon Sep 17 00:00:00 2001 From: Abhi Aiyer Date: Mon, 7 Apr 2025 12:55:51 -0700 Subject: [PATCH] Fix workflow in getting started (#3473) ## Description ## Related Issue(s) ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test update ## Checklist - [ ] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation (if applicable) - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] I have generated a changeset for this PR --- .changeset/heavy-emus-eat.md | 5 +++++ packages/cli/src/commands/init/utils.ts | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 .changeset/heavy-emus-eat.md diff --git a/.changeset/heavy-emus-eat.md b/.changeset/heavy-emus-eat.md new file mode 100644 index 00000000000..e4b7c821f05 --- /dev/null +++ b/.changeset/heavy-emus-eat.md @@ -0,0 +1,5 @@ +--- +"mastra": patch +--- + +Fix workflow in getting started diff --git a/packages/cli/src/commands/init/utils.ts b/packages/cli/src/commands/init/utils.ts index a1bcf145843..e9960d81341 100644 --- a/packages/cli/src/commands/init/utils.ts +++ b/packages/cli/src/commands/init/utils.ts @@ -152,12 +152,24 @@ const agent = new Agent({ \`, }); +const forecastSchema = z.array( + z.object({ + date: z.string(), + maxTemp: z.number(), + minTemp: z.number(), + precipitationChance: z.number(), + condition: z.string(), + location: z.string(), + }), +); + const fetchWeather = new Step({ id: 'fetch-weather', description: 'Fetches weather forecast for a given city', inputSchema: z.object({ city: z.string().describe('The city to get the weather for'), }), + outputSchema: forecastSchema, execute: async ({ context }) => { const triggerData = context?.getStepResult<{ city: string }>('trigger'); @@ -202,23 +214,12 @@ const fetchWeather = new Step({ }, }); -const forecastSchema = z.array( - z.object({ - date: z.string(), - maxTemp: z.number(), - minTemp: z.number(), - precipitationChance: z.number(), - condition: z.string(), - location: z.string(), - }), -); const planActivities = new Step({ id: 'plan-activities', description: 'Suggests activities based on weather conditions', - inputSchema: forecastSchema, execute: async ({ context, mastra }) => { - const forecast = context?.getStepResult>('fetch-weather'); + const forecast = context?.getStepResult(fetchWeather); if (!forecast || forecast.length === 0) { throw new Error('Forecast data not found');