@mastra/dane 0.0.2-alpha.116 → 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.
@@ -31,7 +31,7 @@ const packages_llm_text = `
31
31
  - Format: @mastra/store-{name} -> storage/{name}
32
32
  - Example: @mastra/store-pg -> storage/pg
33
33
 
34
- ## 5. Store packages (combined vector + storage packages) - STRICT RULES:
34
+ ## 5. Store packages - STRICT RULES:
35
35
  - ALL store packages must be directly under stores/
36
36
  - Format: @mastra/{name} -> stores/{name}
37
37
  - Example: @mastra/pg -> stores/pg
@@ -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,4 +1,5 @@
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
4
  import { UpstashStore } from '@mastra/upstash';
4
5
  import { dane, daneChangeLog, daneCommitMessage, daneIssueLabeler, daneLinkChecker } from './agents/index.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,425 +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
- speech: z.array(z.string()),
16
- // deprecated
17
- vector_stores: z.array(z.string()),
18
- stores: z.array(z.string()),
19
- // combined deprecated stores
20
- combined_stores: z.array(z.string()),
21
- });
22
- const defaultSet = {
23
- packages: [],
24
- deployers: [],
25
- integrations: [],
26
- speech: [],
27
- // deprecated
28
- vector_stores: [],
29
- stores: [],
30
- // combined vector + storage
31
- combined_stores: [],
32
- };
33
- const getPacakgesToPublish = new Step({
34
- id: 'getPacakgesToPublish',
35
- outputSchema,
36
- execute: async ({ mastra }) => {
37
- const agent = mastra?.agents?.['danePackagePublisher'];
38
- if (!agent) {
39
- throw new Error('Agent not found');
40
- }
41
- const result = await agent.generate(PACKAGES_LIST_PROMPT);
42
- console.log(chalk.green(`\n${result.text}`));
43
- const resultObj = await agent.generate(`
44
- Please convert this into a structured object:
45
-
46
- Input Text: ${result.text}
47
-
48
- 1. Order Requirements:
49
- - @mastra/core MUST be first within packages
50
- - @mastra/deployer MUST be second within packages
51
- - Group parallel builds by directory type
52
-
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
-
58
- 3. Critical Rules:
59
- - Never publish without building first
60
- - Only include packages that need updates
61
- - Follow dependency order strictly
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
- }),
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(),
72
242
  });
73
- return {
74
- packages: resultObj?.object?.packages,
75
- integrations: resultObj?.object?.integrations,
76
- deployers: resultObj?.object?.deployers,
77
- vector_stores: resultObj?.object?.vector_stores,
78
- stores: resultObj?.object?.stores,
79
- combined_stores: resultObj?.object?.stores,
80
- speech: resultObj?.object?.speech,
81
- };
82
243
  },
83
244
  });
84
- const assemblePackages = new Step({
85
- id: 'assemblePackages',
86
- outputSchema,
87
- execute: async ({ context }) => {
88
- if (context.machineContext?.stepResults.getPacakgesToPublish?.status !== 'success') {
89
- return {
90
- packages: [],
91
- integrations: [],
92
- deployers: [],
93
- vector_stores: [],
94
- stores: [],
95
- combined_stores: [],
96
- speech: [],
97
- };
98
- }
99
- const payload = context.machineContext.stepResults.getPacakgesToPublish.payload;
100
- const packagesToBuild = new Set();
101
- const deployersToBuild = new Set();
102
- const integrationsToBuild = new Set();
103
- const vector_storesToBuild = new Set();
104
- const storesToBuild = new Set();
105
- const combined_storesToBuild = new Set();
106
- const speechToBuild = new Set();
107
- if (payload?.packages) {
108
- payload.packages.forEach((pkg) => {
109
- let pkgName = pkg.replace('@mastra/', '');
110
- if (pkgName === 'mastra') {
111
- pkgName = 'cli';
112
- }
113
- const pkgPath = path.join(process.cwd(), 'packages', pkgName);
114
- packagesToBuild.add(pkgPath);
115
- });
116
- }
117
- if (payload?.deployers) {
118
- payload.deployers.forEach((pkg) => {
119
- let pkgName = pkg.replace('@mastra/deployer-', '');
120
- if (pkgName === 'mastra') {
121
- pkgName = 'cli';
122
- }
123
- const pkgPath = path.join(process.cwd(), 'deployers', pkgName);
124
- deployersToBuild.add(pkgPath);
125
- });
126
- }
127
- if (payload?.vector_stores) {
128
- payload.vector_stores.forEach((pkg) => {
129
- let pkgName = pkg.replace('@mastra/vector-', '');
130
- const pkgPath = path.join(process.cwd(), 'vector-stores', pkgName);
131
- vector_storesToBuild.add(pkgPath);
132
- });
133
- }
134
- if (payload?.stores) {
135
- payload.stores.forEach((pkg) => {
136
- let pkgName = pkg.replace('@mastra/store-', '');
137
- const pkgPath = path.join(process.cwd(), 'storage', pkgName);
138
- storesToBuild.add(pkgPath);
139
- });
140
- }
141
- if (payload?.combined_stores) {
142
- payload.combined_stores.forEach((pkg) => {
143
- let pkgName = pkg.replace('@mastra/', '');
144
- const pkgPath = path.join(process.cwd(), 'stores', pkgName);
145
- combined_storesToBuild.add(pkgPath);
146
- });
147
- }
148
- if (payload?.integrations) {
149
- const integrations = payload.integrations;
150
- integrations.forEach((integration) => {
151
- let pkgName = integration.replace('@mastra/', '');
152
- const integrationPath = path.join(process.cwd(), 'integrations', pkgName);
153
- integrationsToBuild.add(integrationPath);
154
- });
155
- }
156
- if (payload?.speech) {
157
- const speecs = payload.speech;
158
- speecs.forEach((speech) => {
159
- let pkgName = speech.replace('@mastra/speech-', '');
160
- const speechPath = path.join(process.cwd(), 'speech', pkgName);
161
- speechToBuild.add(speechPath);
162
- });
163
- }
164
- const pkgSet = Array.from(packagesToBuild.keys());
165
- const deploySet = Array.from(deployersToBuild.keys());
166
- const integrationSet = Array.from(integrationsToBuild.keys());
167
- const vectorStoreSet = Array.from(vector_storesToBuild.keys());
168
- const storeSet = Array.from(storesToBuild.keys());
169
- const combinedStoreSet = Array.from(combined_storesToBuild.keys());
170
- const speechSet = Array.from(speechToBuild.keys());
171
- if (!packagesToBuild.size &&
172
- !deployersToBuild.size &&
173
- !integrationsToBuild.size &&
174
- !vector_storesToBuild.size &&
175
- !storesToBuild.size &&
176
- !combined_storesToBuild.size) {
177
- console.error(chalk.red('No packages to build.'));
178
- return defaultSet;
179
- }
180
- console.log(chalk.green(`\nBuilding packages:\n`));
181
- pkgSet.forEach((pkg) => {
182
- 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(),
183
253
  });
184
- if (deploySet.length > 0) {
185
- console.log(chalk.green(`\nBuilding deployers:\n`));
186
- deploySet.forEach((pkg) => {
187
- console.log(chalk.green(pkg));
188
- });
189
- }
190
- if (integrationSet.length > 0) {
191
- console.log(chalk.green(`\nBuilding integrations:\n`));
192
- integrationSet.forEach((pkg) => {
193
- console.log(chalk.green(pkg));
194
- });
195
- }
196
- if (vectorStoreSet.length > 0) {
197
- console.log(chalk.green(`\nBuilding vector stores:\n`));
198
- vectorStoreSet.forEach((pkg) => {
199
- console.log(chalk.green(pkg));
200
- });
201
- }
202
- if (storeSet.length > 0) {
203
- console.log(chalk.green(`\nBuilding storage packages:\n`));
204
- storeSet.forEach((pkg) => {
205
- console.log(chalk.green(pkg));
206
- });
207
- }
208
- if (combinedStoreSet.length > 0) {
209
- console.log(chalk.green(`\nBuilding store packages:\n`));
210
- combinedStoreSet.forEach((pkg) => {
211
- console.log(chalk.green(pkg));
212
- });
213
- }
214
- if (speechSet.length > 0) {
215
- console.log(chalk.green(`\nBuilding speech:\n`));
216
- speechSet.forEach((pkg) => {
217
- console.log(chalk.green(pkg));
218
- });
219
- }
220
- return {
221
- packages: pkgSet,
222
- deployers: deploySet,
223
- integrations: integrationSet,
224
- vector_stores: vectorStoreSet,
225
- stores: storeSet,
226
- combined_stores: combinedStoreSet,
227
- speech: speechSet,
228
- };
229
254
  },
230
255
  });
231
- const buildPackages = new Step({
232
- id: 'buildPackages',
233
- outputSchema,
234
- execute: async ({ context, mastra }) => {
235
- if (context.machineContext?.stepResults.assemblePackages?.status !== 'success') {
236
- return defaultSet;
237
- }
238
- const pkgSet = context.machineContext.stepResults.assemblePackages.payload.packages;
239
- const deploySet = context.machineContext.stepResults.assemblePackages.payload.deployers;
240
- const integrationSet = context.machineContext.stepResults.assemblePackages.payload.integrations;
241
- const vectorStoreSet = context.machineContext.stepResults.assemblePackages.payload.vector_stores;
242
- const storeSet = context.machineContext.stepResults.assemblePackages.payload.stores;
243
- const combinedStoreSet = context.machineContext.stepResults.assemblePackages.payload.combined_stores;
244
- const speechSet = context.machineContext.stepResults.assemblePackages.payload.speech;
245
- console.log({
246
- pkgSet,
247
- deploySet,
248
- integrationSet,
249
- vectorStoreSet,
250
- storeSet,
251
- combinedStoreSet,
252
- speechSet,
253
- });
254
- const agent = mastra?.agents?.['danePackagePublisher'];
255
- if (!agent) {
256
- 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
+ }
257
281
  }
258
- async function buildSet(list) {
259
- for (const pkg of list) {
260
- await pnpmBuild.execute({
261
- context: {
262
- name: pkg,
263
- packagePath: pkg,
264
- },
265
- 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,
266
291
  });
267
292
  }
268
- }
269
- let built = false;
270
- if (pkgSet.length > 0) {
271
- built = true;
272
- await buildSet(pkgSet);
273
- }
274
- if (deploySet.length > 0) {
275
- await buildSet(deploySet);
276
- built = true;
277
- }
278
- if (integrationSet.length > 0) {
279
- await buildSet(integrationSet);
280
- built = true;
281
- }
282
- if (vectorStoreSet.length > 0) {
283
- await buildSet(vectorStoreSet);
284
- built = true;
285
- }
286
- if (speechSet.length > 0) {
287
- await buildSet(speechSet);
288
- built = true;
289
- }
290
- if (!built) {
291
- console.error(chalk.red('Failed to build one or more packages'));
292
- throw new Error('Failed to build one or more packages');
293
- }
294
- return {
295
- packages: pkgSet,
296
- deployers: deploySet,
297
- integrations: integrationSet,
298
- vector_stores: vectorStoreSet,
299
- stores: storeSet,
300
- combined_stores: combinedStoreSet,
301
- speech: speechSet,
302
- };
303
- },
304
- });
305
- const verifyBuild = new Step({
306
- id: 'verifyBuild',
307
- outputSchema: z.object({
308
- packages: z.array(z.string()),
309
- }),
310
- execute: async ({ context }) => {
311
- if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
312
- return {
313
- packages: [],
314
- };
315
- }
316
- const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
317
- const deploySet = context.machineContext.stepResults.buildPackages.payload.deployers;
318
- const integrationSet = context.machineContext.stepResults.buildPackages.payload.integrations;
319
- const vectorStoreSet = context.machineContext.stepResults.buildPackages.payload.vector_stores;
320
- const storeSet = context.machineContext.stepResults.buildPackages.payload.stores;
321
- const combinedStoreSet = context.machineContext.stepResults.buildPackages.payload.combined_stores;
322
- const speechSet = context.machineContext.stepResults.buildPackages.payload.speech;
323
- const allPackages = [
324
- ...pkgSet,
325
- ...deploySet,
326
- ...integrationSet,
327
- ...vectorStoreSet,
328
- ...storeSet,
329
- ...combinedStoreSet,
330
- ...speechSet,
331
- ];
332
- function checkMissingPackages(pkgSet) {
333
- const missingPackages = [];
334
- for (const pkg of pkgSet) {
335
- if (!existsSync(`${pkg}/dist`)) {
336
- console.error(chalk.red(`We did not find the dist folder for ${pkg}.`));
337
- missingPackages.push(pkg);
338
- }
293
+ catch (error) {
294
+ console.error(chalk.red(`Failed to set dist tag for ${pkg.name}: ${error.message}`));
339
295
  }
340
- return missingPackages;
341
- }
342
- console.log('Verifying the output for:', context.machineContext.stepResults.buildPackages.payload.allPackages);
343
- const missingPackages = checkMissingPackages(allPackages);
344
- if (missingPackages.length > 0) {
345
- console.error(chalk.red(`Missing packages: ${missingPackages.join(', ')}`));
346
- throw new Error('Failed to build one or more packages');
347
- }
348
- return {
349
- packages: allPackages,
350
- };
351
- },
352
- });
353
- const publishChangeset = new Step({
354
- id: 'publishChangeset',
355
- outputSchema: z.object({
356
- packages: z.array(z.string()),
357
- }),
358
- execute: async ({ context, mastra }) => {
359
- if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
360
- return {
361
- packages: [],
362
- };
363
296
  }
364
- const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
365
- const agent = mastra?.agents?.['danePackagePublisher'];
366
- if (!agent) {
367
- throw new Error('Agent not found');
368
- }
369
- const res = await agent.generate(PUBLISH_PACKAGES_PROMPT);
370
- console.log(chalk.green(res.text));
371
- return { packages: pkgSet };
372
297
  },
373
298
  });
374
- const setLatestDistTag = new Step({
375
- id: 'setLatestDistTag',
376
- outputSchema: z.object({
377
- packages: z.array(z.string()),
378
- }),
379
- execute: async ({ context, mastra }) => {
380
- if (context.machineContext?.stepResults.publishChangeset?.status !== 'success') {
381
- return {
382
- packages: [],
383
- };
384
- }
385
- const pkgSet = context.machineContext.stepResults.publishChangeset.payload.packages;
386
- const agent = mastra?.agents?.['danePackagePublisher'];
387
- if (!agent) {
388
- throw new Error('Agent not found');
389
- }
390
- let res = await agent.generate(`
391
- Set the active tag for these packages ${pkgSet.join(',')}.
392
- `);
393
- console.log(chalk.green(res.text));
394
- return { packages: pkgSet };
395
- },
396
- });
397
- packagePublisher
398
- .step(getPacakgesToPublish)
399
- .then(assemblePackages)
400
- .then(buildPackages, {
401
- when: async ({ context }) => {
402
- return (context.stepResults.assemblePackages?.status === 'success' &&
403
- context.stepResults.assemblePackages?.payload?.packages.length > 0);
404
- },
405
- })
406
- .then(verifyBuild, {
407
- when: async ({ context }) => {
408
- return (context.stepResults.buildPackages?.status === 'success' &&
409
- context.stepResults.buildPackages?.payload?.packages.length > 0);
410
- },
411
- })
412
- .after(verifyBuild)
413
- .step(publishChangeset, {
414
- when: async ({ context }) => {
415
- return (context.stepResults.buildPackages?.status === 'success' &&
416
- context.stepResults.buildPackages?.payload?.packages.length > 0);
417
- },
418
- })
419
- .then(setLatestDistTag, {
420
- when: async ({ context }) => {
421
- return (context.stepResults.publishChangeset?.status === 'success' &&
422
- context.stepResults.publishChangeset?.payload?.packages.length > 0);
423
- },
424
- })
425
- .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.116",
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.149"
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.92",
45
- "@mastra/github": "1.0.3-alpha.77",
46
- "@mastra/mcp": "0.1.0-alpha.34",
47
- "@mastra/memory": "0.1.0-alpha.74",
48
- "@mastra/rag": "0.1.0-alpha.85",
49
- "@mastra/stabilityai": "1.0.1-alpha.67",
50
- "@mastra/upstash": "0.1.0-alpha.1"
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",