@balazsbarta/mp-skills 0.1.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/.agents/skills/brainstorming/SKILL.md +201 -0
- package/.agents/skills/brainstorming/references/option-evaluation.md +64 -0
- package/.agents/skills/brainstorming/references/questioning-playbook.md +57 -0
- package/.agents/skills/brainstorming/references/repo-analysis.md +60 -0
- package/.agents/skills/conventional-commits/SKILL.md +124 -0
- package/.agents/skills/conventional-commits/references/commit-types-scopes.md +75 -0
- package/.agents/skills/conventional-commits/references/semantic-release.md +71 -0
- package/.agents/skills/jest/SKILL.md +219 -0
- package/.agents/skills/jest/references/common-errors.md +274 -0
- package/.agents/skills/jest/references/configuration.md +175 -0
- package/.agents/skills/jest/references/embedded-docs.md +44 -0
- package/.agents/skills/jest/references/mocking.md +206 -0
- package/.agents/skills/jest/references/remote-docs.md +19 -0
- package/.agents/skills/jest/references/snapshot-testing.md +181 -0
- package/.agents/skills/jest/references/transforms.md +216 -0
- package/.agents/skills/maestro/SKILL.md +230 -0
- package/.agents/skills/maestro/references/assertions-commands.md +259 -0
- package/.agents/skills/maestro/references/common-errors.md +273 -0
- package/.agents/skills/maestro/references/eas-ci-integration.md +219 -0
- package/.agents/skills/maestro/references/flow-authoring.md +224 -0
- package/.agents/skills/maestro/references/remote-docs.md +23 -0
- package/.agents/skills/mastra/SKILL.md +159 -0
- package/.agents/skills/mastra/references/common-errors.md +535 -0
- package/.agents/skills/mastra/references/create-mastra.md +220 -0
- package/.agents/skills/mastra/references/embedded-docs.md +123 -0
- package/.agents/skills/mastra/references/migration-guide.md +180 -0
- package/.agents/skills/mastra/references/remote-docs.md +193 -0
- package/.agents/skills/next-js/SKILL.md +209 -0
- package/.agents/skills/next-js/references/api-routes.md +213 -0
- package/.agents/skills/next-js/references/app-router.md +206 -0
- package/.agents/skills/next-js/references/caching-revalidation.md +211 -0
- package/.agents/skills/next-js/references/common-errors.md +251 -0
- package/.agents/skills/next-js/references/embedded-docs.md +43 -0
- package/.agents/skills/next-js/references/metadata-seo.md +257 -0
- package/.agents/skills/next-js/references/remote-docs.md +22 -0
- package/.agents/skills/playwright/SKILL.md +218 -0
- package/.agents/skills/playwright/references/ci-configuration.md +208 -0
- package/.agents/skills/playwright/references/common-errors.md +258 -0
- package/.agents/skills/playwright/references/embedded-docs.md +41 -0
- package/.agents/skills/playwright/references/fixtures-assertions.md +208 -0
- package/.agents/skills/playwright/references/page-objects.md +167 -0
- package/.agents/skills/playwright/references/remote-docs.md +23 -0
- package/.agents/skills/playwright/references/visual-regression.md +206 -0
- package/.agents/skills/pull-request-lifecycle/SKILL.md +116 -0
- package/.agents/skills/pull-request-lifecycle/references/changelog-versioning.md +72 -0
- package/.agents/skills/pull-request-lifecycle/references/merge-strategies.md +33 -0
- package/.agents/skills/pull-request-lifecycle/references/pr-description-template.md +72 -0
- package/.agents/skills/pull-request-lifecycle/references/review-process.md +54 -0
- package/.agents/skills/pull-request-lifecycle/scripts/code_review.py +220 -0
- package/.agents/skills/react-native-expo/SKILL.md +212 -0
- package/.agents/skills/react-native-expo/references/common-errors.md +251 -0
- package/.agents/skills/react-native-expo/references/eas-build-submit.md +238 -0
- package/.agents/skills/react-native-expo/references/embedded-docs.md +42 -0
- package/.agents/skills/react-native-expo/references/native-modules.md +181 -0
- package/.agents/skills/react-native-expo/references/navigation-setup.md +229 -0
- package/.agents/skills/react-native-expo/references/remote-docs.md +23 -0
- package/.agents/skills/supabase/SKILL.md +216 -0
- package/.agents/skills/supabase/references/auth-setup.md +206 -0
- package/.agents/skills/supabase/references/common-errors.md +285 -0
- package/.agents/skills/supabase/references/edge-functions.md +178 -0
- package/.agents/skills/supabase/references/embedded-docs.md +43 -0
- package/.agents/skills/supabase/references/migrations.md +193 -0
- package/.agents/skills/supabase/references/remote-docs.md +24 -0
- package/.agents/skills/supabase/references/rls-policies.md +187 -0
- package/.agents/skills/supabase/references/storage.md +182 -0
- package/.agents/skills/task-breakdown/SKILL.md +179 -0
- package/.agents/skills/task-breakdown/references/acceptance-criteria.md +165 -0
- package/.agents/skills/task-breakdown/references/epic-story-format.md +209 -0
- package/.agents/skills/task-breakdown/references/estimation-guide.md +140 -0
- package/.agents/skills/vitest/SKILL.md +219 -0
- package/.agents/skills/vitest/references/common-errors.md +271 -0
- package/.agents/skills/vitest/references/component-testing.md +182 -0
- package/.agents/skills/vitest/references/configuration.md +184 -0
- package/.agents/skills/vitest/references/coverage.md +179 -0
- package/.agents/skills/vitest/references/embedded-docs.md +43 -0
- package/.agents/skills/vitest/references/mocking.md +182 -0
- package/.agents/skills/vitest/references/remote-docs.md +22 -0
- package/README.md +235 -0
- package/package.json +20 -0
- package/scripts/skills.mjs +849 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Create Mastra Reference
|
|
2
|
+
|
|
3
|
+
Complete guide for creating new Mastra projects. Includes both quickstart CLI method and detailed manual installation.
|
|
4
|
+
|
|
5
|
+
**Official documentation: [mastra.ai/docs](https://mastra.ai/docs)**
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
Ask: **"How would you like to create your Mastra project?"**
|
|
10
|
+
|
|
11
|
+
1. **Quick Setup**: Copy and run: `npm create mastra@latest`
|
|
12
|
+
2. **Guided Setup**: I walk you through each step, you approve commands
|
|
13
|
+
3. **Automatic Setup**: I create everything, just give me your API key
|
|
14
|
+
|
|
15
|
+
> **For AI agents:** The CLI is interactive. Use **Automatic Setup** to create files using the steps in "Automatic Setup / Manual Installation" below.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- An API key from a supported model provider (OpenAI, Anthropic, Google, etc.)
|
|
20
|
+
|
|
21
|
+
## Quick Setup (user runs CLI)
|
|
22
|
+
|
|
23
|
+
Create a new Mastra project with one command:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm create mastra@latest
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Other package managers:**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm create mastra@latest
|
|
33
|
+
yarn create mastra@latest
|
|
34
|
+
bun create mastra@latest
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## CLI flags
|
|
38
|
+
|
|
39
|
+
**Skip the example agent:**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm create mastra@latest --no-example
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Use a specific template:**
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm create mastra@latest --template <template-name>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Automatic setup / manual installation
|
|
52
|
+
|
|
53
|
+
**Use this for automatic setup** (AI creates all files) or when you prefer manual control.
|
|
54
|
+
|
|
55
|
+
Follow these steps to create a complete Mastra project:
|
|
56
|
+
|
|
57
|
+
### Step 1: Create project directory
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mkdir my-first-agent && cd my-first-agent
|
|
61
|
+
npm init -y
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Step 2: Install dependencies
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install -D typescript @types/node mastra@latest
|
|
68
|
+
npm install @mastra/core@latest zod@^4
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 3: Configure package scripts
|
|
72
|
+
|
|
73
|
+
Add to `package.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"scripts": {
|
|
78
|
+
"dev": "mastra dev",
|
|
79
|
+
"build": "mastra build"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Step 4: Configure TypeScript
|
|
85
|
+
|
|
86
|
+
Create `tsconfig.json`:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"compilerOptions": {
|
|
91
|
+
"target": "ES2022",
|
|
92
|
+
"module": "ES2022",
|
|
93
|
+
"moduleResolution": "bundler",
|
|
94
|
+
"esModuleInterop": true,
|
|
95
|
+
"forceConsistentCasingInFileNames": true,
|
|
96
|
+
"strict": true,
|
|
97
|
+
"skipLibCheck": true,
|
|
98
|
+
"noEmit": true,
|
|
99
|
+
"outDir": "dist"
|
|
100
|
+
},
|
|
101
|
+
"include": ["src/**/*"]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Important:** Mastra requires `"module": "ES2022"` and `"moduleResolution": "bundler"`. CommonJS will cause errors.
|
|
106
|
+
|
|
107
|
+
### Step 5: Create environment file
|
|
108
|
+
|
|
109
|
+
Create `.env` with your API key:
|
|
110
|
+
|
|
111
|
+
```env
|
|
112
|
+
GOOGLE_GENERATIVE_AI_API_KEY=<your-api-key>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Or use `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.
|
|
116
|
+
|
|
117
|
+
### Step 6: Create weather tool
|
|
118
|
+
|
|
119
|
+
Create `src/mastra/tools/weather-tool.ts`:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { createTool } from "@mastra/core/tools";
|
|
123
|
+
import { z } from "zod";
|
|
124
|
+
|
|
125
|
+
export const weatherTool = createTool({
|
|
126
|
+
id: "get-weather",
|
|
127
|
+
description: "Get current weather for a location",
|
|
128
|
+
inputSchema: z.object({
|
|
129
|
+
location: z.string().describe("City name"),
|
|
130
|
+
}),
|
|
131
|
+
outputSchema: z.object({
|
|
132
|
+
output: z.string(),
|
|
133
|
+
}),
|
|
134
|
+
execute: async () => {
|
|
135
|
+
return { output: "The weather is sunny" };
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Step 7: Create weather agent
|
|
141
|
+
|
|
142
|
+
Create `src/mastra/agents/weather-agent.ts`:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
import { Agent } from "@mastra/core/agent";
|
|
146
|
+
import { weatherTool } from "../tools/weather-tool";
|
|
147
|
+
|
|
148
|
+
export const weatherAgent = new Agent({
|
|
149
|
+
id: "weather-agent",
|
|
150
|
+
name: "Weather Agent",
|
|
151
|
+
instructions: `
|
|
152
|
+
You are a helpful weather assistant that provides accurate weather information.
|
|
153
|
+
|
|
154
|
+
Your primary function is to help users get weather details for specific locations. When responding:
|
|
155
|
+
- Always ask for a location if none is provided
|
|
156
|
+
- If the location name isn't in English, please translate it
|
|
157
|
+
- If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
|
|
158
|
+
- Include relevant details like humidity, wind conditions, and precipitation
|
|
159
|
+
- Keep responses concise but informative
|
|
160
|
+
|
|
161
|
+
Use the weatherTool to fetch current weather data.
|
|
162
|
+
`,
|
|
163
|
+
model: "google/gemini-2.5-pro",
|
|
164
|
+
tools: { weatherTool },
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Note:** Model format is `"provider/model-name"`. Examples:
|
|
169
|
+
|
|
170
|
+
- `"google/gemini-2.5-pro"`
|
|
171
|
+
- `"openai/gpt-4o"`
|
|
172
|
+
- `"anthropic/claude-3-5-sonnet-20241022"`
|
|
173
|
+
|
|
174
|
+
### Step 8: Create mastra entry point
|
|
175
|
+
|
|
176
|
+
Create `src/mastra/index.ts`:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { Mastra } from "@mastra/core";
|
|
180
|
+
import { weatherAgent } from "./agents/weather-agent";
|
|
181
|
+
|
|
182
|
+
export const mastra = new Mastra({
|
|
183
|
+
agents: { weatherAgent },
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Step 9: Launch development server
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm run dev
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Access Studio at `http://localhost:4111` to test your agent.
|
|
194
|
+
|
|
195
|
+
## Next steps
|
|
196
|
+
|
|
197
|
+
After creating your project with `create mastra`:
|
|
198
|
+
|
|
199
|
+
- **Customize the example agent** in `src/mastra/agents/weather-agent.ts`
|
|
200
|
+
- **Add new agents** - see [Agents documentation](https://mastra.ai/docs/agents/overview)
|
|
201
|
+
- **Create workflows** - see [Workflows documentation](https://mastra.ai/docs/workflows/overview)
|
|
202
|
+
- **Add more tools** to extend agent capabilities
|
|
203
|
+
- **Integrate into your app** - see framework guides at [mastra.ai/docs](https://mastra.ai/docs)
|
|
204
|
+
|
|
205
|
+
## Troubleshooting
|
|
206
|
+
|
|
207
|
+
| Issue | Solution |
|
|
208
|
+
| ------------------ | ------------------------------------------------------------------------------------ |
|
|
209
|
+
| API key not found | Make sure your `.env` file has the correct key |
|
|
210
|
+
| Studio won't start | Check that port 4111 is available |
|
|
211
|
+
| CommonJS errors | Ensure `tsconfig.json` uses `"module": "ES2022"` and `"moduleResolution": "bundler"` |
|
|
212
|
+
| Command not found | Ensure you're using Node.js 20+ |
|
|
213
|
+
|
|
214
|
+
## Resources
|
|
215
|
+
|
|
216
|
+
- [Docs](https://mastra.ai/docs)
|
|
217
|
+
- [Installation](https://mastra.ai/docs/getting-started/installation)
|
|
218
|
+
- [Agents](https://mastra.ai/docs/agents/overview)
|
|
219
|
+
- [Workflows](https://mastra.ai/docs/workflows/overview)
|
|
220
|
+
- [GitHub](https://github.com/mastra-ai/mastra)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Embedded Docs Reference
|
|
2
|
+
|
|
3
|
+
Look up API signatures from embedded docs in `node_modules/@mastra/*/dist/docs/` - these match the installed version.
|
|
4
|
+
|
|
5
|
+
**Use this FIRST** when Mastra packages are installed locally. Embedded docs are always accurate for the installed version.
|
|
6
|
+
|
|
7
|
+
## Why use embedded docs
|
|
8
|
+
|
|
9
|
+
- **Version accuracy**: Embedded docs match the exact installed version
|
|
10
|
+
- **No network required**: All docs are local in `node_modules/`
|
|
11
|
+
- **Mastra evolves quickly**: APIs change rapidly, embedded docs stay in sync
|
|
12
|
+
- **TypeScript definitions**: Includes JSDoc, type signatures, and examples
|
|
13
|
+
- **Training data may be outdated**: Claude's knowledge cutoff may not reflect latest APIs
|
|
14
|
+
|
|
15
|
+
## Documentation structure
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
node_modules/@mastra/core/dist/docs/
|
|
19
|
+
├── SKILL.md # Package overview, exports
|
|
20
|
+
├── SOURCE_MAP.json # Export→file mappings
|
|
21
|
+
└── [topics]/ # Feature docs (agents/, workflows/, etc.)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Lookup process
|
|
25
|
+
|
|
26
|
+
### 1. Check if packages are installed
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
ls node_modules/@mastra/
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If you see packages like `core`, `memory`, `rag`, etc., proceed with embedded docs lookup.
|
|
33
|
+
|
|
34
|
+
### 2. Find the export in SOURCE_MAP.json
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"Agent"'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Returns: `{ "Agent": { "types": "dist/agent/agent.d.ts", ... } }`
|
|
41
|
+
|
|
42
|
+
### 3. Read the type definition
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cat node_modules/@mastra/core/dist/agent/agent.d.ts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This shows the exact TypeScript interface, constructor parameters, and JSDoc.
|
|
49
|
+
|
|
50
|
+
### 4. Check topic docs (optional)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cat node_modules/@mastra/core/dist/docs/agents/01-overview.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Topic docs provide conceptual explanations and usage examples.
|
|
57
|
+
|
|
58
|
+
## Common packages
|
|
59
|
+
|
|
60
|
+
| Package | Path | Contains |
|
|
61
|
+
| ---------------- | ---------------------------------------- | ----------------------------------------- |
|
|
62
|
+
| `@mastra/core` | `node_modules/@mastra/core/dist/docs/` | Agents, Workflows, Tools, Mastra instance |
|
|
63
|
+
| `@mastra/memory` | `node_modules/@mastra/memory/dist/docs/` | Memory systems, conversation history |
|
|
64
|
+
| `@mastra/rag` | `node_modules/@mastra/rag/dist/docs/` | RAG features, vector stores |
|
|
65
|
+
| `@mastra/pg` | `node_modules/@mastra/pg/dist/docs/` | PostgreSQL storage |
|
|
66
|
+
| `@mastra/libsql` | `node_modules/@mastra/libsql/dist/docs/` | LibSQL/SQLite storage |
|
|
67
|
+
|
|
68
|
+
## Quick commands reference
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# List installed @mastra packages
|
|
72
|
+
ls node_modules/@mastra/
|
|
73
|
+
|
|
74
|
+
# Find specific export in SOURCE_MAP
|
|
75
|
+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"ExportName"'
|
|
76
|
+
|
|
77
|
+
# Read type definition from path
|
|
78
|
+
cat node_modules/@mastra/core/dist/[path-from-source-map]
|
|
79
|
+
|
|
80
|
+
# List available topic documentation
|
|
81
|
+
ls node_modules/@mastra/core/dist/docs/
|
|
82
|
+
|
|
83
|
+
# View package overview
|
|
84
|
+
cat node_modules/@mastra/core/dist/docs/SKILL.md
|
|
85
|
+
|
|
86
|
+
# Search for specific functionality in source
|
|
87
|
+
grep -r "functionName" node_modules/@mastra/core/src/
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Example: Looking up agent constructor
|
|
91
|
+
|
|
92
|
+
**1. Find Agent in SOURCE_MAP:**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"Agent"'
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**2. Read the type definition:**
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cat node_modules/@mastra/core/dist/agent/agent.d.ts
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**3. Check topic docs for usage examples:**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
cat node_modules/@mastra/core/dist/docs/agents/01-overview.md
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## When embedded docs are not available
|
|
111
|
+
|
|
112
|
+
If packages aren't installed or `dist/docs/` doesn't exist:
|
|
113
|
+
|
|
114
|
+
1. **Recommend installation**: Suggest installing packages to access embedded docs
|
|
115
|
+
2. **Fall back to remote docs**: See `references/remote-docs.md`
|
|
116
|
+
|
|
117
|
+
## Best Practices
|
|
118
|
+
|
|
119
|
+
1. **Always check SOURCE_MAP.json first** to find the correct file path
|
|
120
|
+
2. **Read type definitions** for exact parameter names and types
|
|
121
|
+
3. **Check topic docs** for conceptual understanding and patterns
|
|
122
|
+
4. **Search source code** if docs don't answer the question
|
|
123
|
+
5. **Verify imports** match what's exported in the type definitions
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
Guide for upgrading Mastra versions using official documentation and current API verification.
|
|
4
|
+
|
|
5
|
+
## Migration strategy
|
|
6
|
+
|
|
7
|
+
For version upgrades, follow this process:
|
|
8
|
+
|
|
9
|
+
### 1. Check official migration docs
|
|
10
|
+
|
|
11
|
+
**Always start with the official migration documentation:** `https://mastra.ai/llms.txt`
|
|
12
|
+
|
|
13
|
+
Look for the **Migrations** or **Guides** section, which will have:
|
|
14
|
+
|
|
15
|
+
- Breaking changes for each version
|
|
16
|
+
- Automated migration tools
|
|
17
|
+
- Step-by-step upgrade instructions
|
|
18
|
+
|
|
19
|
+
**Example sections to look for:**
|
|
20
|
+
|
|
21
|
+
- `/guides/migrations/upgrade-to-v1/`
|
|
22
|
+
- `/guides/migrations/upgrade-to-v2/`
|
|
23
|
+
- Breaking changes lists
|
|
24
|
+
|
|
25
|
+
### 2. Use embedded docs for current APIs
|
|
26
|
+
|
|
27
|
+
After identifying breaking changes, verify the new APIs:
|
|
28
|
+
|
|
29
|
+
**Check your installed version:**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"ApiName"'
|
|
33
|
+
cat node_modules/@mastra/core/dist/[path-from-source-map]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
See [`embedded-docs.md`](embedded-docs.md) for detailed lookup instructions.
|
|
37
|
+
|
|
38
|
+
### 3. Use remote docs for latest info
|
|
39
|
+
|
|
40
|
+
If packages aren't updated yet, check what APIs will look like: `https://mastra.ai/reference/[topic]`
|
|
41
|
+
|
|
42
|
+
See [`remote-docs.md`](remote-docs.md) for detailed lookup instructions.
|
|
43
|
+
|
|
44
|
+
## Quick migration workflow
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 1. Check current version
|
|
48
|
+
npm list @mastra/core
|
|
49
|
+
|
|
50
|
+
# 2. Fetch migration guide from official docs
|
|
51
|
+
# Use WebFetch: https://mastra.ai/llms.txt
|
|
52
|
+
# Find relevant migration section
|
|
53
|
+
|
|
54
|
+
# 3. Update dependencies
|
|
55
|
+
npm install @mastra/core@latest @mastra/memory@latest @mastra/rag@latest mastra@latest
|
|
56
|
+
|
|
57
|
+
# 4. Run automated migration (if available)
|
|
58
|
+
npx @mastra/codemod@latest v1 # or whatever version
|
|
59
|
+
|
|
60
|
+
# 5. Check embedded docs for new APIs
|
|
61
|
+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json
|
|
62
|
+
|
|
63
|
+
# 6. Fix breaking changes using embedded docs lookup
|
|
64
|
+
# See embedded-docs.md for how to look up each API
|
|
65
|
+
|
|
66
|
+
# 7. Test
|
|
67
|
+
npm run dev
|
|
68
|
+
npm test
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Common migration patterns
|
|
72
|
+
|
|
73
|
+
### Finding what changed
|
|
74
|
+
|
|
75
|
+
**Check official migration docs:** `https://mastra.ai/guides/migrations/upgrade-to-v1/overview.md`
|
|
76
|
+
|
|
77
|
+
This will list:
|
|
78
|
+
|
|
79
|
+
- Breaking changes
|
|
80
|
+
- Deprecated APIs
|
|
81
|
+
- New features
|
|
82
|
+
- Migration tools
|
|
83
|
+
|
|
84
|
+
### Updating API usage
|
|
85
|
+
|
|
86
|
+
**For each breaking change:**
|
|
87
|
+
|
|
88
|
+
1. **Find the old API** in your code
|
|
89
|
+
2. **Look up the new API** using embedded docs:
|
|
90
|
+
```bash
|
|
91
|
+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"NewApi"'
|
|
92
|
+
cat node_modules/@mastra/core/dist/[path]
|
|
93
|
+
```
|
|
94
|
+
3. **Update your code** based on the type signatures
|
|
95
|
+
4. **Test** the change
|
|
96
|
+
|
|
97
|
+
### Example: Tool execute signature change
|
|
98
|
+
|
|
99
|
+
**Official docs say:** "Tool execute signature changed"
|
|
100
|
+
|
|
101
|
+
**Look up current signature:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"createTool"'
|
|
105
|
+
cat node_modules/@mastra/core/dist/tools/tool.d.ts
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Update based on type definition:**
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// Old (from docs)
|
|
112
|
+
execute: async (input) => { ... }
|
|
113
|
+
|
|
114
|
+
// New (from embedded docs)
|
|
115
|
+
execute: async (inputData, context) => { ... }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Pre-migration checklist
|
|
119
|
+
|
|
120
|
+
- [ ] Backup code (git commit)
|
|
121
|
+
- [ ] Check official migration docs: `https://mastra.ai/llms.txt`
|
|
122
|
+
- [ ] Note current version: `npm list @mastra/core`
|
|
123
|
+
- [ ] Read breaking changes list
|
|
124
|
+
- [ ] Tests are passing
|
|
125
|
+
|
|
126
|
+
## Post-migration checklist
|
|
127
|
+
|
|
128
|
+
- [ ] All dependencies updated together
|
|
129
|
+
- [ ] TypeScript compiles: `npx tsc --noEmit`
|
|
130
|
+
- [ ] Tests pass: `npm test`
|
|
131
|
+
- [ ] Studio works: `npm run dev`
|
|
132
|
+
- [ ] No console warnings
|
|
133
|
+
- [ ] APIs verified against embedded docs
|
|
134
|
+
|
|
135
|
+
## Migration resources
|
|
136
|
+
|
|
137
|
+
| Resource | Use For |
|
|
138
|
+
| -------------------------------------- | --------------------------------------------- |
|
|
139
|
+
| `https://mastra.ai/llms.txt` | Finding migration guides and breaking changes |
|
|
140
|
+
| [`embedded-docs.md`](embedded-docs.md) | Looking up new API signatures after updating |
|
|
141
|
+
| [`remote-docs.md`](remote-docs.md) | Checking latest docs before updating |
|
|
142
|
+
| [`common-errors.md`](common-errors.md) | Fixing migration errors |
|
|
143
|
+
|
|
144
|
+
## Version-specific notes
|
|
145
|
+
|
|
146
|
+
### General principles
|
|
147
|
+
|
|
148
|
+
1. **Always update all @mastra packages together**
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npm install @mastra/core@latest @mastra/memory@latest @mastra/rag@latest mastra@latest
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
2. **Check for automated migration tools**
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npx @mastra/codemod@latest [version]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
3. **Verify Node.js version requirements**
|
|
161
|
+
- Check official migration docs for minimum Node version
|
|
162
|
+
|
|
163
|
+
4. **Run database migrations if using storage**
|
|
164
|
+
- Follow storage migration guide in official docs
|
|
165
|
+
|
|
166
|
+
## Getting help
|
|
167
|
+
|
|
168
|
+
1. **Check official migration docs**: `https://mastra.ai/llms.txt` → Migrations section
|
|
169
|
+
2. **Look up new APIs**: See [`embedded-docs.md`](embedded-docs.md)
|
|
170
|
+
3. **Check for errors**: See [`common-errors.md`](common-errors.md)
|
|
171
|
+
4. **Ask in Discord**: https://discord.gg/BTYqqHKUrf
|
|
172
|
+
5. **File issues**: https://github.com/mastra-ai/mastra/issues
|
|
173
|
+
|
|
174
|
+
## Key principles
|
|
175
|
+
|
|
176
|
+
1. **Official docs are source of truth** - Start with `https://mastra.ai/llms.txt`
|
|
177
|
+
2. **Verify with embedded docs** - Check installed version APIs
|
|
178
|
+
3. **Update incrementally** - Don't skip major versions
|
|
179
|
+
4. **Test thoroughly** - Run tests after each change
|
|
180
|
+
5. **Use automation** - Use codemods when available
|