@mastra/dane 0.0.2-alpha.115 → 0.0.2-alpha.117

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.
@@ -1 +1 @@
1
- {"version":3,"file":"package-publisher.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/package-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAqD3C,eAAO,MAAM,oBAAoB,iwBAa5B,CAAC;AAEN,eAAO,MAAM,qBAAqB,aAAc,MAAM,EAAE,WAyDvD,CAAC;AAEF,eAAO,MAAM,uBAAuB,u2BAwBnC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA+B/B,CAAC"}
1
+ {"version":3,"file":"package-publisher.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/package-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AA0D3C,eAAO,MAAM,oBAAoB,iwBAa5B,CAAC;AAEN,eAAO,MAAM,qBAAqB,aAAc,MAAM,EAAE,WA8DvD,CAAC;AAEF,eAAO,MAAM,uBAAuB,u2BAwBnC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA+B/B,CAAC"}
@@ -31,11 +31,16 @@ const packages_llm_text = `
31
31
  - Format: @mastra/store-{name} -> storage/{name}
32
32
  - Example: @mastra/store-pg -> storage/pg
33
33
 
34
- ## 5. Speech packages - STRICT RULES:
34
+ ## 5. Store packages - STRICT RULES:
35
+ - ALL store packages must be directly under stores/
36
+ - Format: @mastra/{name} -> stores/{name}
37
+ - Example: @mastra/pg -> stores/pg
38
+
39
+ ## 6. Speech packages - STRICT RULES:
35
40
  - ALL speech packages must be directly under speech/
36
41
  - Format: @mastra/speech-{name} -> speech/{name}
37
42
 
38
- ## 6. Integrations - STRICT RULES:
43
+ ## 7. Integrations - STRICT RULES:
39
44
  - ALL integration packages are under integrations/
40
45
  @mastra/composio -> integrations/composio
41
46
  @mastra/github -> integrations/github
@@ -104,6 +109,11 @@ export const BUILD_PACKAGES_PROMPT = (packages) => `
104
109
  <description>Build storage/ directory packages</description>
105
110
  <action>Use pnpmBuild for each @mastra/store-* package</action>
106
111
  </parallel_phase>
112
+
113
+ <parallel_phase name="stores">
114
+ <description>Build stores/ directory packages</description>
115
+ <action>Use pnpmBuild for each @mastra/* package in stores/</action>
116
+ </parallel_phase>
107
117
  </phase>
108
118
  </execution_plan>
109
119
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mastra/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAc3D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mJAiCjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mastra/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAetC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mJAiCjB,CAAC"}
@@ -1,6 +1,7 @@
1
- import { Mastra, MastraStorageLibSql } from '@mastra/core';
1
+ import { Mastra } from '@mastra/core';
2
+ import { DefaultStorage } from '@mastra/core/storage';
2
3
  import { Memory } from '@mastra/memory';
3
- import { UpstashStore } from '@mastra/store-upstash';
4
+ import { UpstashStore } from '@mastra/upstash';
4
5
  import { dane, daneChangeLog, daneCommitMessage, daneIssueLabeler, daneLinkChecker } from './agents/index.js';
5
6
  import { daneNewContributor } from './agents/new-contributor.js';
6
7
  import { danePackagePublisher } from './agents/package-publisher.js';
@@ -20,7 +21,7 @@ export const mastra = new Mastra({
20
21
  daneChangeLog,
21
22
  daneNewContributor,
22
23
  },
23
- storage: new MastraStorageLibSql({
24
+ storage: new DefaultStorage({
24
25
  config: {
25
26
  url: ':memory:',
26
27
  },
@@ -1 +1 @@
1
- {"version":3,"file":"publish-packages.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/publish-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AASxD,eAAO,MAAM,gBAAgB,oBAE3B,CAAC"}
1
+ {"version":3,"file":"publish-packages.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/publish-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAYxD,eAAO,MAAM,gBAAgB,oBAE3B,CAAC"}
@@ -1,387 +1,299 @@
1
1
  import { Step, Workflow } from '@mastra/core/workflows';
2
2
  import chalk from 'chalk';
3
+ import { execa } from 'execa';
3
4
  import { existsSync } from 'fs';
5
+ import { readFileSync } from 'fs';
4
6
  import path from 'path';
5
- import { z } from 'zod';
6
- import { PACKAGES_LIST_PROMPT, PUBLISH_PACKAGES_PROMPT } from '../agents/package-publisher.js';
7
- import { pnpmBuild } from '../tools/pnpm.js';
7
+ // import { z } from 'zod';
8
+ // import { PACKAGES_LIST_PROMPT, /*PUBLISH_PACKAGES_PROMPT*/ } from '../agents/package-publisher.js';
9
+ // import { pnpmBuild } from '../tools/pnpm.js';
8
10
  export const packagePublisher = new Workflow({
9
11
  name: 'pnpm-changset-publisher',
10
12
  });
11
- const outputSchema = z.object({
12
- packages: z.array(z.string()),
13
- integrations: z.array(z.string()),
14
- deployers: z.array(z.string()),
15
- vector_stores: z.array(z.string()),
16
- stores: z.array(z.string()),
17
- speech: z.array(z.string()),
18
- });
19
- const defaultSet = {
20
- packages: [],
21
- deployers: [],
22
- integrations: [],
23
- vector_stores: [],
24
- stores: [],
25
- speech: [],
26
- };
27
- const getPacakgesToPublish = new Step({
28
- id: 'getPacakgesToPublish',
29
- outputSchema,
30
- execute: async ({ mastra }) => {
31
- const agent = mastra?.agents?.['danePackagePublisher'];
32
- if (!agent) {
33
- throw new Error('Agent not found');
34
- }
35
- const result = await agent.generate(PACKAGES_LIST_PROMPT);
36
- console.log(chalk.green(`\n${result.text}`));
37
- const resultObj = await agent.generate(`
38
- Please convert this into a structured object:
39
-
40
- Input Text: ${result.text}
41
-
42
- 1. Order Requirements:
43
- - @mastra/core MUST be first within packages
44
- - @mastra/deployer MUST be second within packages
45
- - Group parallel builds by directory type
46
-
47
- 2. Output Format:
48
- - Group into: packages[], integrations[], deployers[], vector_stores[], stores[]
49
- - Place create-mastra in packages[] array
50
- - Maintain correct order within each group
51
-
52
- 3. Critical Rules:
53
- - Never publish without building first
54
- - Only include packages that need updates
55
- - Follow dependency order strictly
56
- `, {
57
- output: z.object({
58
- packages: z.array(z.string()),
59
- integrations: z.array(z.string()),
60
- deployers: z.array(z.string()),
61
- vector_stores: z.array(z.string()),
62
- stores: z.array(z.string()),
63
- speech: z.array(z.string()),
64
- }),
13
+ // const outputSchema = z.object({
14
+ // packages: z.array(z.string()),
15
+ // integrations: z.array(z.string()),
16
+ // deployers: z.array(z.string()),
17
+ // speech: z.array(z.string()),
18
+ // // deprecated
19
+ // vector_stores: z.array(z.string()),
20
+ // stores: z.array(z.string()),
21
+ // // combined deprecated stores
22
+ // combined_stores: z.array(z.string()),
23
+ // });
24
+ // const defaultSet = {
25
+ // packages: [],
26
+ // deployers: [],
27
+ // integrations: [],
28
+ // speech: [],
29
+ // // deprecated
30
+ // vector_stores: [],
31
+ // stores: [],
32
+ // // combined vector + storage
33
+ // combined_stores: [],
34
+ // };
35
+ // const getPacakgesToPublish = new Step({
36
+ // id: 'getPacakgesToPublish',
37
+ // outputSchema,
38
+ // execute: async ({ mastra }) => {
39
+ // const agent = mastra?.agents?.['danePackagePublisher'];
40
+ // if (!agent) {
41
+ // throw new Error('Agent not found');
42
+ // }
43
+ // const result = await agent.generate(PACKAGES_LIST_PROMPT);
44
+ // console.log(chalk.green(`\n${result.text}`));
45
+ // const resultObj = await agent.generate(
46
+ // `
47
+ // Please convert this into a structured object:
48
+ // Input Text: ${result.text}
49
+ // 1. Order Requirements:
50
+ // - @mastra/core MUST be first within packages
51
+ // - @mastra/deployer MUST be second within packages
52
+ // - Group parallel builds by directory type
53
+ // 2. Output Format:
54
+ // - Group into: packages[], integrations[], deployers[], vector_stores[], stores[], combined_stores[]
55
+ // - Place create-mastra in packages[] array
56
+ // - Maintain correct order within each group
57
+ // 3. Critical Rules:
58
+ // - Never publish without building first
59
+ // - Only include packages that need updates
60
+ // - Follow dependency order strictly
61
+ // `,
62
+ // {
63
+ // output: z.object({
64
+ // packages: z.array(z.string()),
65
+ // integrations: z.array(z.string()),
66
+ // deployers: z.array(z.string()),
67
+ // vector_stores: z.array(z.string()),
68
+ // stores: z.array(z.string()),
69
+ // combined_stores: z.array(z.string()),
70
+ // speech: z.array(z.string()),
71
+ // }),
72
+ // },
73
+ // );
74
+ // return {
75
+ // packages: resultObj?.object?.packages!,
76
+ // integrations: resultObj?.object?.integrations!,
77
+ // deployers: resultObj?.object?.deployers!,
78
+ // vector_stores: resultObj?.object?.vector_stores!,
79
+ // stores: resultObj?.object?.stores!,
80
+ // combined_stores: resultObj?.object?.stores!,
81
+ // speech: resultObj?.object?.speech!,
82
+ // };
83
+ // },
84
+ // });
85
+ // const assemblePackages = new Step({
86
+ // id: 'assemblePackages',
87
+ // outputSchema,
88
+ // execute: async ({ context }) => {
89
+ // if (context.machineContext?.stepResults.getPacakgesToPublish?.status !== 'success') {
90
+ // return {
91
+ // packages: [],
92
+ // integrations: [],
93
+ // deployers: [],
94
+ // vector_stores: [],
95
+ // stores: [],
96
+ // combined_stores: [],
97
+ // speech: [],
98
+ // };
99
+ // }
100
+ // const payload = context.machineContext.stepResults.getPacakgesToPublish.payload;
101
+ // const packagesToBuild: Set<string> = new Set();
102
+ // const deployersToBuild: Set<string> = new Set();
103
+ // const integrationsToBuild: Set<string> = new Set();
104
+ // const vector_storesToBuild: Set<string> = new Set();
105
+ // const storesToBuild: Set<string> = new Set();
106
+ // const combined_storesToBuild: Set<string> = new Set();
107
+ // const speechToBuild: Set<string> = new Set();
108
+ // if (payload?.packages) {
109
+ // payload.packages.forEach((pkg: string) => {
110
+ // let pkgName = pkg.replace('@mastra/', '');
111
+ // if (pkgName === 'mastra') {
112
+ // pkgName = 'cli';
113
+ // }
114
+ // const pkgPath = path.join(process.cwd(), 'packages', pkgName);
115
+ // packagesToBuild.add(pkgPath);
116
+ // });
117
+ // }
118
+ // if (payload?.deployers) {
119
+ // payload.deployers.forEach((pkg: string) => {
120
+ // let pkgName = pkg.replace('@mastra/deployer-', '');
121
+ // if (pkgName === 'mastra') {
122
+ // pkgName = 'cli';
123
+ // }
124
+ // const pkgPath = path.join(process.cwd(), 'deployers', pkgName);
125
+ // deployersToBuild.add(pkgPath);
126
+ // });
127
+ // }
128
+ // if (payload?.vector_stores) {
129
+ // payload.vector_stores.forEach((pkg: string) => {
130
+ // let pkgName = pkg.replace('@mastra/vector-', '');
131
+ // const pkgPath = path.join(process.cwd(), 'vector-stores', pkgName);
132
+ // vector_storesToBuild.add(pkgPath);
133
+ // });
134
+ // }
135
+ // if (payload?.stores) {
136
+ // payload.stores.forEach((pkg: string) => {
137
+ // let pkgName = pkg.replace('@mastra/store-', '');
138
+ // const pkgPath = path.join(process.cwd(), 'storage', pkgName);
139
+ // storesToBuild.add(pkgPath);
140
+ // });
141
+ // }
142
+ // if (payload?.combined_stores) {
143
+ // payload.combined_stores.forEach((pkg: string) => {
144
+ // let pkgName = pkg.replace('@mastra/', '');
145
+ // const pkgPath = path.join(process.cwd(), 'stores', pkgName);
146
+ // combined_storesToBuild.add(pkgPath);
147
+ // });
148
+ // }
149
+ // if (payload?.integrations) {
150
+ // const integrations = payload.integrations;
151
+ // integrations.forEach((integration: string) => {
152
+ // let pkgName = integration.replace('@mastra/', '');
153
+ // const integrationPath = path.join(process.cwd(), 'integrations', pkgName);
154
+ // integrationsToBuild.add(integrationPath);
155
+ // });
156
+ // }
157
+ // if (payload?.speech) {
158
+ // const speecs = payload.speech;
159
+ // speecs.forEach((speech: string) => {
160
+ // let pkgName = speech.replace('@mastra/speech-', '');
161
+ // const speechPath = path.join(process.cwd(), 'speech', pkgName);
162
+ // speechToBuild.add(speechPath);
163
+ // });
164
+ // }
165
+ // const pkgSet = Array.from(packagesToBuild.keys());
166
+ // const deploySet = Array.from(deployersToBuild.keys());
167
+ // const integrationSet = Array.from(integrationsToBuild.keys());
168
+ // const vectorStoreSet = Array.from(vector_storesToBuild.keys());
169
+ // const storeSet = Array.from(storesToBuild.keys());
170
+ // const combinedStoreSet = Array.from(combined_storesToBuild.keys());
171
+ // const speechSet = Array.from(speechToBuild.keys());
172
+ // if (
173
+ // !packagesToBuild.size &&
174
+ // !deployersToBuild.size &&
175
+ // !integrationsToBuild.size &&
176
+ // !vector_storesToBuild.size &&
177
+ // !storesToBuild.size &&
178
+ // !combined_storesToBuild.size
179
+ // ) {
180
+ // console.error(chalk.red('No packages to build.'));
181
+ // return defaultSet;
182
+ // }
183
+ // console.log(chalk.green(`\nBuilding packages:\n`));
184
+ // pkgSet.forEach((pkg: string) => {
185
+ // console.log(chalk.green(pkg));
186
+ // });
187
+ // if (deploySet.length > 0) {
188
+ // console.log(chalk.green(`\nBuilding deployers:\n`));
189
+ // deploySet.forEach((pkg: string) => {
190
+ // console.log(chalk.green(pkg));
191
+ // });
192
+ // }
193
+ // if (integrationSet.length > 0) {
194
+ // console.log(chalk.green(`\nBuilding integrations:\n`));
195
+ // integrationSet.forEach((pkg: string) => {
196
+ // console.log(chalk.green(pkg));
197
+ // });
198
+ // }
199
+ // if (vectorStoreSet.length > 0) {
200
+ // console.log(chalk.green(`\nBuilding vector stores:\n`));
201
+ // vectorStoreSet.forEach((pkg: string) => {
202
+ // console.log(chalk.green(pkg));
203
+ // });
204
+ // }
205
+ // if (storeSet.length > 0) {
206
+ // console.log(chalk.green(`\nBuilding storage packages:\n`));
207
+ // storeSet.forEach((pkg: string) => {
208
+ // console.log(chalk.green(pkg));
209
+ // });
210
+ // }
211
+ // if (combinedStoreSet.length > 0) {
212
+ // console.log(chalk.green(`\nBuilding store packages:\n`));
213
+ // combinedStoreSet.forEach((pkg: string) => {
214
+ // console.log(chalk.green(pkg));
215
+ // });
216
+ // }
217
+ // if (speechSet.length > 0) {
218
+ // console.log(chalk.green(`\nBuilding speech:\n`));
219
+ // speechSet.forEach((pkg: string) => {
220
+ // console.log(chalk.green(pkg));
221
+ // });
222
+ // }
223
+ // return {
224
+ // packages: pkgSet!,
225
+ // deployers: deploySet!,
226
+ // integrations: integrationSet!,
227
+ // vector_stores: vectorStoreSet!,
228
+ // stores: storeSet!,
229
+ // combined_stores: combinedStoreSet!,
230
+ // speech: speechSet!,
231
+ // };
232
+ // },
233
+ // });
234
+ const buildAllPackages = new Step({
235
+ id: 'buildPackages',
236
+ execute: async () => {
237
+ console.log(chalk.green('Building all packages'));
238
+ await execa('pnpm', ['run', 'build'], {
239
+ stdio: 'inherit',
240
+ reject: false,
241
+ cwd: process.cwd(),
65
242
  });
66
- return {
67
- packages: resultObj?.object?.packages,
68
- integrations: resultObj?.object?.integrations,
69
- deployers: resultObj?.object?.deployers,
70
- vector_stores: resultObj?.object?.vector_stores,
71
- stores: resultObj?.object?.stores,
72
- speech: resultObj?.object?.speech,
73
- };
74
243
  },
75
244
  });
76
- const assemblePackages = new Step({
77
- id: 'assemblePackages',
78
- outputSchema,
79
- execute: async ({ context }) => {
80
- if (context.machineContext?.stepResults.getPacakgesToPublish?.status !== 'success') {
81
- return {
82
- packages: [],
83
- integrations: [],
84
- deployers: [],
85
- vector_stores: [],
86
- stores: [],
87
- speech: [],
88
- };
89
- }
90
- const payload = context.machineContext.stepResults.getPacakgesToPublish.payload;
91
- const packagesToBuild = new Set();
92
- const deployersToBuild = new Set();
93
- const integrationsToBuild = new Set();
94
- const vector_storesToBuild = new Set();
95
- const storesToBuild = new Set();
96
- const speechToBuild = new Set();
97
- if (payload?.packages) {
98
- payload.packages.forEach((pkg) => {
99
- let pkgName = pkg.replace('@mastra/', '');
100
- if (pkgName === 'mastra') {
101
- pkgName = 'cli';
102
- }
103
- const pkgPath = path.join(process.cwd(), 'packages', pkgName);
104
- packagesToBuild.add(pkgPath);
105
- });
106
- }
107
- if (payload?.deployers) {
108
- payload.deployers.forEach((pkg) => {
109
- let pkgName = pkg.replace('@mastra/deployer-', '');
110
- if (pkgName === 'mastra') {
111
- pkgName = 'cli';
112
- }
113
- const pkgPath = path.join(process.cwd(), 'deployers', pkgName);
114
- deployersToBuild.add(pkgPath);
115
- });
116
- }
117
- if (payload?.vector_stores) {
118
- payload.vector_stores.forEach((pkg) => {
119
- let pkgName = pkg.replace('@mastra/vector-', '');
120
- const pkgPath = path.join(process.cwd(), 'vector-stores', pkgName);
121
- vector_storesToBuild.add(pkgPath);
122
- });
123
- }
124
- if (payload?.stores) {
125
- payload.stores.forEach((pkg) => {
126
- let pkgName = pkg.replace('@mastra/store-', '');
127
- const pkgPath = path.join(process.cwd(), 'storage', pkgName);
128
- storesToBuild.add(pkgPath);
129
- });
130
- }
131
- if (payload?.integrations) {
132
- const integrations = payload.integrations;
133
- integrations.forEach((integration) => {
134
- let pkgName = integration.replace('@mastra/', '');
135
- const integrationPath = path.join(process.cwd(), 'integrations', pkgName);
136
- integrationsToBuild.add(integrationPath);
137
- });
138
- }
139
- if (payload?.speech) {
140
- const speecs = payload.speech;
141
- speecs.forEach((speech) => {
142
- let pkgName = speech.replace('@mastra/speech-', '');
143
- const speechPath = path.join(process.cwd(), 'speech', pkgName);
144
- speechToBuild.add(speechPath);
145
- });
146
- }
147
- const pkgSet = Array.from(packagesToBuild.keys());
148
- const deploySet = Array.from(deployersToBuild.keys());
149
- const integrationSet = Array.from(integrationsToBuild.keys());
150
- const vectorStoreSet = Array.from(vector_storesToBuild.keys());
151
- const storeSet = Array.from(storesToBuild.keys());
152
- const speechSet = Array.from(speechToBuild.keys());
153
- if (!packagesToBuild.size &&
154
- !deployersToBuild.size &&
155
- !integrationsToBuild.size &&
156
- !vector_storesToBuild.size &&
157
- !storesToBuild.size) {
158
- console.error(chalk.red('No packages to build.'));
159
- return defaultSet;
160
- }
161
- console.log(chalk.green(`\nBuilding packages:\n`));
162
- pkgSet.forEach((pkg) => {
163
- console.log(chalk.green(pkg));
245
+ const publishAllPackages = new Step({
246
+ id: 'publishPackages',
247
+ execute: async () => {
248
+ console.log(chalk.green('Publishing all packages'));
249
+ await execa('pnpm', ['changeset', 'publish'], {
250
+ stdio: 'inherit',
251
+ reject: false,
252
+ cwd: process.cwd(),
164
253
  });
165
- if (deploySet.length > 0) {
166
- console.log(chalk.green(`\nBuilding deployers:\n`));
167
- deploySet.forEach((pkg) => {
168
- console.log(chalk.green(pkg));
169
- });
170
- }
171
- if (integrationSet.length > 0) {
172
- console.log(chalk.green(`\nBuilding integrations:\n`));
173
- integrationSet.forEach((pkg) => {
174
- console.log(chalk.green(pkg));
175
- });
176
- }
177
- if (vectorStoreSet.length > 0) {
178
- console.log(chalk.green(`\nBuilding vector stores:\n`));
179
- vectorStoreSet.forEach((pkg) => {
180
- console.log(chalk.green(pkg));
181
- });
182
- }
183
- if (storeSet.length > 0) {
184
- console.log(chalk.green(`\nBuilding storage packages:\n`));
185
- storeSet.forEach((pkg) => {
186
- console.log(chalk.green(pkg));
187
- });
188
- }
189
- if (speechSet.length > 0) {
190
- console.log(chalk.green(`\nBuilding speech:\n`));
191
- speechSet.forEach((pkg) => {
192
- console.log(chalk.green(pkg));
193
- });
194
- }
195
- return {
196
- packages: pkgSet,
197
- deployers: deploySet,
198
- integrations: integrationSet,
199
- vector_stores: vectorStoreSet,
200
- stores: storeSet,
201
- speech: speechSet,
202
- };
203
254
  },
204
255
  });
205
- const buildPackages = new Step({
206
- id: 'buildPackages',
207
- outputSchema,
208
- execute: async ({ context, mastra }) => {
209
- if (context.machineContext?.stepResults.assemblePackages?.status !== 'success') {
210
- return defaultSet;
211
- }
212
- const pkgSet = context.machineContext.stepResults.assemblePackages.payload.packages;
213
- const deploySet = context.machineContext.stepResults.assemblePackages.payload.deployers;
214
- const integrationSet = context.machineContext.stepResults.assemblePackages.payload.integrations;
215
- const vectorStoreSet = context.machineContext.stepResults.assemblePackages.payload.vector_stores;
216
- const storeSet = context.machineContext.stepResults.assemblePackages.payload.stores;
217
- const speechSet = context.machineContext.stepResults.assemblePackages.payload.speech;
218
- console.log({
219
- pkgSet,
220
- deploySet,
221
- integrationSet,
222
- vectorStoreSet,
223
- storeSet,
224
- speechSet,
225
- });
226
- const agent = mastra?.agents?.['danePackagePublisher'];
227
- if (!agent) {
228
- throw new Error('Agent not found');
256
+ const setAllDistTags = new Step({
257
+ id: 'setAllDistTags',
258
+ execute: async () => {
259
+ console.log(chalk.green('Setting dist tags for all packages'));
260
+ // Get all package.json files from relevant directories
261
+ const packageDirs = ['packages', 'deployers', 'storage', 'vector-stores', 'stores', 'integrations', 'speech'];
262
+ const packages = [];
263
+ for (const dir of packageDirs) {
264
+ const dirPath = path.join(process.cwd(), dir);
265
+ if (!existsSync(dirPath))
266
+ continue;
267
+ const { stdout } = await execa('find', [dirPath, '-name', 'package.json'], {
268
+ reject: false,
269
+ });
270
+ const packagePaths = stdout.split('\n').filter(Boolean);
271
+ for (const packagePath of packagePaths) {
272
+ const pkgJson = JSON.parse(readFileSync(packagePath, 'utf-8'));
273
+ if (pkgJson.name && pkgJson.version) {
274
+ packages.push({
275
+ name: pkgJson.name,
276
+ version: pkgJson.version,
277
+ path: path.dirname(packagePath),
278
+ });
279
+ }
280
+ }
229
281
  }
230
- async function buildSet(list) {
231
- for (const pkg of list) {
232
- await pnpmBuild.execute({
233
- context: {
234
- name: pkg,
235
- packagePath: pkg,
236
- },
237
- suspend: async () => { },
282
+ console.log(packages);
283
+ // Set dist tags for each package
284
+ for (const pkg of packages) {
285
+ console.log(chalk.blue(`Setting dist tag for ${pkg.name}@${pkg.version}`));
286
+ try {
287
+ await execa('npm', ['dist-tag', 'add', `${pkg.name}@${pkg.version}`, 'latest'], {
288
+ stdio: 'inherit',
289
+ cwd: pkg.path,
290
+ reject: false,
238
291
  });
239
292
  }
240
- }
241
- let built = false;
242
- if (pkgSet.length > 0) {
243
- built = true;
244
- await buildSet(pkgSet);
245
- }
246
- if (deploySet.length > 0) {
247
- await buildSet(deploySet);
248
- built = true;
249
- }
250
- if (integrationSet.length > 0) {
251
- await buildSet(integrationSet);
252
- built = true;
253
- }
254
- if (vectorStoreSet.length > 0) {
255
- await buildSet(vectorStoreSet);
256
- built = true;
257
- }
258
- if (speechSet.length > 0) {
259
- await buildSet(speechSet);
260
- built = true;
261
- }
262
- if (!built) {
263
- console.error(chalk.red('Failed to build one or more packages'));
264
- throw new Error('Failed to build one or more packages');
265
- }
266
- return {
267
- packages: pkgSet,
268
- deployers: deploySet,
269
- integrations: integrationSet,
270
- vector_stores: vectorStoreSet,
271
- stores: storeSet,
272
- speech: speechSet,
273
- };
274
- },
275
- });
276
- const verifyBuild = new Step({
277
- id: 'verifyBuild',
278
- outputSchema: z.object({
279
- packages: z.array(z.string()),
280
- }),
281
- execute: async ({ context }) => {
282
- if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
283
- return {
284
- packages: [],
285
- };
286
- }
287
- const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
288
- const deploySet = context.machineContext.stepResults.buildPackages.payload.deployers;
289
- const integrationSet = context.machineContext.stepResults.buildPackages.payload.integrations;
290
- const vectorStoreSet = context.machineContext.stepResults.buildPackages.payload.vector_stores;
291
- const storeSet = context.machineContext.stepResults.buildPackages.payload.stores;
292
- const speechSet = context.machineContext.stepResults.buildPackages.payload.speech;
293
- const allPackages = [...pkgSet, ...deploySet, ...integrationSet, ...vectorStoreSet, ...storeSet, ...speechSet];
294
- function checkMissingPackages(pkgSet) {
295
- const missingPackages = [];
296
- for (const pkg of pkgSet) {
297
- if (!existsSync(`${pkg}/dist`)) {
298
- console.error(chalk.red(`We did not find the dist folder for ${pkg}.`));
299
- missingPackages.push(pkg);
300
- }
293
+ catch (error) {
294
+ console.error(chalk.red(`Failed to set dist tag for ${pkg.name}: ${error.message}`));
301
295
  }
302
- return missingPackages;
303
- }
304
- console.log('Verifying the output for:', context.machineContext.stepResults.buildPackages.payload.allPackages);
305
- const missingPackages = checkMissingPackages(allPackages);
306
- if (missingPackages.length > 0) {
307
- console.error(chalk.red(`Missing packages: ${missingPackages.join(', ')}`));
308
- throw new Error('Failed to build one or more packages');
309
- }
310
- return {
311
- packages: allPackages,
312
- };
313
- },
314
- });
315
- const publishChangeset = new Step({
316
- id: 'publishChangeset',
317
- outputSchema: z.object({
318
- packages: z.array(z.string()),
319
- }),
320
- execute: async ({ context, mastra }) => {
321
- if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
322
- return {
323
- packages: [],
324
- };
325
- }
326
- const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
327
- const agent = mastra?.agents?.['danePackagePublisher'];
328
- if (!agent) {
329
- throw new Error('Agent not found');
330
- }
331
- const res = await agent.generate(PUBLISH_PACKAGES_PROMPT);
332
- console.log(chalk.green(res.text));
333
- return { packages: pkgSet };
334
- },
335
- });
336
- const setLatestDistTag = new Step({
337
- id: 'setLatestDistTag',
338
- outputSchema: z.object({
339
- packages: z.array(z.string()),
340
- }),
341
- execute: async ({ context, mastra }) => {
342
- if (context.machineContext?.stepResults.publishChangeset?.status !== 'success') {
343
- return {
344
- packages: [],
345
- };
346
296
  }
347
- const pkgSet = context.machineContext.stepResults.publishChangeset.payload.packages;
348
- const agent = mastra?.agents?.['danePackagePublisher'];
349
- if (!agent) {
350
- throw new Error('Agent not found');
351
- }
352
- let res = await agent.generate(`
353
- Set the active tag for these packages ${pkgSet.join(',')}.
354
- `);
355
- console.log(chalk.green(res.text));
356
- return { packages: pkgSet };
357
297
  },
358
298
  });
359
- packagePublisher
360
- .step(getPacakgesToPublish)
361
- .then(assemblePackages)
362
- .then(buildPackages, {
363
- when: async ({ context }) => {
364
- return (context.stepResults.assemblePackages?.status === 'success' &&
365
- context.stepResults.assemblePackages?.payload?.packages.length > 0);
366
- },
367
- })
368
- .then(verifyBuild, {
369
- when: async ({ context }) => {
370
- return (context.stepResults.buildPackages?.status === 'success' &&
371
- context.stepResults.buildPackages?.payload?.packages.length > 0);
372
- },
373
- })
374
- .after(verifyBuild)
375
- .step(publishChangeset, {
376
- when: async ({ context }) => {
377
- return (context.stepResults.buildPackages?.status === 'success' &&
378
- context.stepResults.buildPackages?.payload?.packages.length > 0);
379
- },
380
- })
381
- .then(setLatestDistTag, {
382
- when: async ({ context }) => {
383
- return (context.stepResults.publishChangeset?.status === 'success' &&
384
- context.stepResults.publishChangeset?.payload?.packages.length > 0);
385
- },
386
- })
387
- .commit();
299
+ packagePublisher.step(buildAllPackages).then(publishAllPackages).then(setAllDistTags).commit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/dane",
3
- "version": "0.0.2-alpha.115",
3
+ "version": "0.0.2-alpha.117",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "@types/node": "^22.10.2",
21
21
  "@types/pdf-parse": "^1.1.4",
22
22
  "tsx": "^4.19.2",
23
- "mastra": "0.2.0-alpha.144"
23
+ "mastra": "0.2.0-alpha.150"
24
24
  },
25
25
  "dependencies": {
26
26
  "@inquirer/prompts": "^7.2.1",
@@ -41,13 +41,13 @@
41
41
  "sqlite3": "^5.1.7",
42
42
  "typescript": "^5.7.3",
43
43
  "zod": "^3.24.0",
44
- "@mastra/core": "0.2.0-alpha.91",
45
- "@mastra/mcp": "0.1.0-alpha.33",
46
- "@mastra/github": "1.0.3-alpha.76",
47
- "@mastra/rag": "0.1.0-alpha.83",
48
- "@mastra/store-upstash": "0.0.0-alpha.10",
49
- "@mastra/memory": "0.1.0-alpha.73",
50
- "@mastra/stabilityai": "1.0.1-alpha.66"
44
+ "@mastra/core": "0.2.0-alpha.93",
45
+ "@mastra/mcp": "0.1.0-alpha.35",
46
+ "@mastra/memory": "0.1.0-alpha.75",
47
+ "@mastra/github": "1.0.3-alpha.78",
48
+ "@mastra/upstash": "0.1.0-alpha.3",
49
+ "@mastra/rag": "0.1.0-alpha.86",
50
+ "@mastra/stabilityai": "1.0.1-alpha.68"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "npx tsc",