@mastra/dane 0.0.2-alpha.25 → 0.0.2-alpha.26

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.
Files changed (70) hide show
  1. package/dist/commands/commit-message.d.ts +2 -0
  2. package/dist/commands/commit-message.d.ts.map +1 -0
  3. package/dist/commands/commit-message.js +31 -0
  4. package/dist/commands/config.d.ts +3 -0
  5. package/dist/commands/config.d.ts.map +1 -0
  6. package/dist/commands/config.js +40 -0
  7. package/dist/commands/issue-labeler.d.ts +2 -0
  8. package/dist/commands/issue-labeler.d.ts.map +1 -0
  9. package/dist/commands/issue-labeler.js +34 -0
  10. package/dist/commands/message.d.ts +2 -0
  11. package/dist/commands/message.d.ts.map +1 -0
  12. package/dist/commands/message.js +12 -0
  13. package/dist/commands/publish-packages.d.ts +2 -0
  14. package/dist/commands/publish-packages.d.ts.map +1 -0
  15. package/dist/commands/publish-packages.js +9 -0
  16. package/dist/config/index.d.ts +12 -0
  17. package/dist/config/index.d.ts.map +1 -0
  18. package/dist/config/index.js +75 -0
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +23 -0
  22. package/dist/mastra/agents/index.d.ts +282 -0
  23. package/dist/mastra/agents/index.d.ts.map +1 -0
  24. package/dist/mastra/agents/index.js +106 -0
  25. package/dist/mastra/index.d.ts +318 -0
  26. package/dist/mastra/index.d.ts.map +1 -0
  27. package/dist/mastra/index.js +34 -0
  28. package/dist/mastra/integrations/index.d.ts +7 -0
  29. package/dist/mastra/integrations/index.d.ts.map +1 -0
  30. package/dist/mastra/integrations/index.js +29 -0
  31. package/dist/mastra/tools/browser.d.ts +40 -0
  32. package/dist/mastra/tools/browser.d.ts.map +1 -0
  33. package/dist/mastra/tools/browser.js +116 -0
  34. package/dist/mastra/tools/calendar.d.ts +21 -0
  35. package/dist/mastra/tools/calendar.d.ts.map +1 -0
  36. package/dist/mastra/tools/calendar.js +134 -0
  37. package/dist/mastra/tools/crawl.d.ts +36 -0
  38. package/dist/mastra/tools/crawl.d.ts.map +1 -0
  39. package/dist/mastra/tools/crawl.js +26 -0
  40. package/dist/mastra/tools/execa.d.ts +27 -0
  41. package/dist/mastra/tools/execa.d.ts.map +1 -0
  42. package/dist/mastra/tools/execa.js +43 -0
  43. package/dist/mastra/tools/fs.d.ts +33 -0
  44. package/dist/mastra/tools/fs.d.ts.map +1 -0
  45. package/dist/mastra/tools/fs.js +36 -0
  46. package/dist/mastra/tools/image.d.ts +27 -0
  47. package/dist/mastra/tools/image.d.ts.map +1 -0
  48. package/dist/mastra/tools/image.js +37 -0
  49. package/dist/mastra/tools/pdf.d.ts +21 -0
  50. package/dist/mastra/tools/pdf.d.ts.map +1 -0
  51. package/dist/mastra/tools/pdf.js +42 -0
  52. package/dist/mastra/tools/pnpm.d.ts +60 -0
  53. package/dist/mastra/tools/pnpm.d.ts.map +1 -0
  54. package/dist/mastra/tools/pnpm.js +128 -0
  55. package/dist/mastra/workflows/chat.d.ts +13 -0
  56. package/dist/mastra/workflows/chat.d.ts.map +1 -0
  57. package/dist/mastra/workflows/chat.js +89 -0
  58. package/dist/mastra/workflows/commit-message.d.ts +10 -0
  59. package/dist/mastra/workflows/commit-message.d.ts.map +1 -0
  60. package/dist/mastra/workflows/commit-message.js +137 -0
  61. package/dist/mastra/workflows/index.d.ts +4 -0
  62. package/dist/mastra/workflows/index.d.ts.map +1 -0
  63. package/dist/mastra/workflows/index.js +3 -0
  64. package/dist/mastra/workflows/issue-labeler.d.ts +16 -0
  65. package/dist/mastra/workflows/issue-labeler.d.ts.map +1 -0
  66. package/dist/mastra/workflows/issue-labeler.js +85 -0
  67. package/dist/mastra/workflows/publish-packages.d.ts +3 -0
  68. package/dist/mastra/workflows/publish-packages.d.ts.map +1 -0
  69. package/dist/mastra/workflows/publish-packages.js +188 -0
  70. package/package.json +4 -4
@@ -0,0 +1,188 @@
1
+ import { Step, Workflow } from '@mastra/core';
2
+ import chalk from 'chalk';
3
+ import { readFileSync } from 'fs';
4
+ import path from 'path';
5
+ import { z } from 'zod';
6
+ export const packagePublisher = new Workflow({
7
+ name: 'pnpm-changset-publisher',
8
+ });
9
+ const getPacakgesToPublish = new Step({
10
+ id: 'getPacakgesToPublish',
11
+ outputSchema: z.object({
12
+ packages: z.array(z.string()),
13
+ integrations: z.array(z.string()),
14
+ danePackage: z.string(),
15
+ }),
16
+ execute: async ({ mastra }) => {
17
+ const agent = mastra?.agents?.['danePackagePublisher'];
18
+ if (!agent) {
19
+ throw new Error('Agent not found');
20
+ }
21
+ const result = await agent.generate(`
22
+ Can you tell me which packages within the packages and integrations directory need to be published to npm?
23
+ `);
24
+ const resultObj = await agent.generate(`
25
+ ONLY RETURN DATA IF WE HAVE PACKAGES TO PUBLISH. If we do not, return empty arrays.
26
+ Can you format this for me ${result.text}?
27
+ @mastra/core must be first. @mastra/dane should be listed after packages and integrations.
28
+ `, {
29
+ schema: z.object({
30
+ packages: z.array(z.string()),
31
+ integrations: z.array(z.string()),
32
+ danePackage: z.string(),
33
+ }),
34
+ });
35
+ return {
36
+ packages: resultObj?.object?.packages,
37
+ integrations: resultObj?.object?.integrations,
38
+ danePackage: resultObj?.object?.danePackage,
39
+ };
40
+ },
41
+ });
42
+ const assemblePackages = new Step({
43
+ id: 'assemblePackages',
44
+ outputSchema: z.object({
45
+ packages: z.array(z.string()),
46
+ }),
47
+ execute: async ({ context }) => {
48
+ if (context.machineContext?.stepResults.getPacakgesToPublish?.status !== 'success') {
49
+ return {
50
+ packages: [],
51
+ };
52
+ }
53
+ const payload = context.machineContext.stepResults.getPacakgesToPublish.payload;
54
+ const packagesToBuild = new Set();
55
+ if (payload?.packages) {
56
+ payload.packages.forEach((pkg) => {
57
+ let pkgName = pkg.replace('@mastra/', '');
58
+ if (pkgName === 'mastra') {
59
+ pkgName = 'cli';
60
+ }
61
+ const pkgPath = path.join(process.cwd(), 'packages', pkgName);
62
+ packagesToBuild.add(pkgPath);
63
+ });
64
+ }
65
+ if (payload?.integrations) {
66
+ const integrations = payload.integrations;
67
+ integrations.forEach((integration) => {
68
+ let pkgName = integration.replace('@mastra/', '');
69
+ const integrationPath = path.join(process.cwd(), 'integrations', pkgName);
70
+ packagesToBuild.add(integrationPath);
71
+ });
72
+ }
73
+ if (payload?.danePackage) {
74
+ const danePackage = payload.danePackage;
75
+ let pkgName = danePackage.replace('@mastra/', '');
76
+ const danePackageMapped = path.join(process.cwd(), 'examples', pkgName);
77
+ const pkgJsonPath = readFileSync(path.join(danePackageMapped, 'package.json'), 'utf-8');
78
+ const pkgJson = JSON.parse(pkgJsonPath);
79
+ const dependencies = Object.keys(pkgJson.dependencies || {}).filter((dep) => dep.startsWith('@mastra/'));
80
+ dependencies.forEach((dep) => {
81
+ const pkgName = dep.replace('@mastra/', '');
82
+ const pkgPath = path.join(process.cwd(), 'packages', pkgName);
83
+ packagesToBuild.add(pkgPath);
84
+ });
85
+ packagesToBuild.add(danePackage);
86
+ }
87
+ const pkgSet = Array.from(packagesToBuild.keys());
88
+ if (!packagesToBuild.size) {
89
+ console.error(chalk.red('No packages to build.'));
90
+ return {
91
+ packages: [],
92
+ };
93
+ }
94
+ return { packages: pkgSet };
95
+ },
96
+ });
97
+ const buildPackages = new Step({
98
+ id: 'buildPackages',
99
+ outputSchema: z.object({
100
+ packages: z.array(z.string()),
101
+ }),
102
+ execute: async ({ context, mastra }) => {
103
+ if (context.machineContext?.stepResults.assemblePackages?.status !== 'success') {
104
+ return {
105
+ packages: [],
106
+ };
107
+ }
108
+ const pkgSet = context.machineContext.stepResults.assemblePackages.payload.packages;
109
+ const agent = mastra?.agents?.['danePackagePublisher'];
110
+ if (!agent) {
111
+ throw new Error('Agent not found');
112
+ }
113
+ let res = await agent.generate(`
114
+ Here are the packages that need to be built: ${pkgSet.join(',')}.
115
+ We need to build core first. And dane last. The rest can be done in parallel.
116
+ `);
117
+ console.log(chalk.green(res.text));
118
+ return { packages: pkgSet };
119
+ },
120
+ });
121
+ const publishChangeset = new Step({
122
+ id: 'publishChangeset',
123
+ outputSchema: z.object({
124
+ packages: z.array(z.string()),
125
+ }),
126
+ execute: async ({ context, mastra }) => {
127
+ if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
128
+ return {
129
+ packages: [],
130
+ };
131
+ }
132
+ const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
133
+ const agent = mastra?.agents?.['danePackagePublisher'];
134
+ if (!agent) {
135
+ throw new Error('Agent not found');
136
+ }
137
+ let res = await agent.generate(`
138
+ Publish the changeset.
139
+ `);
140
+ console.log(chalk.green(res.text));
141
+ return { packages: pkgSet };
142
+ },
143
+ });
144
+ const setLatestDistTag = new Step({
145
+ id: 'setLatestDistTag',
146
+ outputSchema: z.object({
147
+ packages: z.array(z.string()),
148
+ }),
149
+ execute: async ({ context, mastra }) => {
150
+ if (context.machineContext?.stepResults.publishChangeset?.status !== 'success') {
151
+ return {
152
+ packages: [],
153
+ };
154
+ }
155
+ const pkgSet = context.machineContext.stepResults.publishChangeset.payload.packages;
156
+ const agent = mastra?.agents?.['danePackagePublisher'];
157
+ if (!agent) {
158
+ throw new Error('Agent not found');
159
+ }
160
+ let res = await agent.generate(`
161
+ Set the active tag for these packages ${pkgSet.join(',')}.
162
+ `);
163
+ console.log(chalk.green(res.text));
164
+ return { packages: pkgSet };
165
+ },
166
+ });
167
+ packagePublisher
168
+ .step(getPacakgesToPublish)
169
+ .then(assemblePackages)
170
+ .then(buildPackages, {
171
+ when: async ({ context }) => {
172
+ return (context.stepResults.assemblePackages?.status === 'success' &&
173
+ context.stepResults.assemblePackages?.payload?.packages.length > 0);
174
+ },
175
+ })
176
+ .then(publishChangeset, {
177
+ when: async ({ context }) => {
178
+ return (context.stepResults.buildPackages?.status === 'success' &&
179
+ context.stepResults.buildPackages?.payload?.packages.length > 0);
180
+ },
181
+ })
182
+ .then(setLatestDistTag, {
183
+ when: async ({ context }) => {
184
+ return (context.stepResults.publishChangeset?.status === 'success' &&
185
+ context.stepResults.publishChangeset?.payload?.packages.length > 0);
186
+ },
187
+ })
188
+ .commit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/dane",
3
- "version": "0.0.2-alpha.25",
3
+ "version": "0.0.2-alpha.26",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -38,13 +38,13 @@
38
38
  "sqlite3": "^5.1.7",
39
39
  "typescript": "^5.5.4",
40
40
  "zod": "^3.24.0",
41
- "@mastra/firecrawl": "1.0.4-alpha.32",
42
41
  "@mastra/core": "0.1.27-alpha.46",
42
+ "@mastra/engine": "0.0.5-alpha.40",
43
+ "@mastra/firecrawl": "1.0.4-alpha.32",
43
44
  "@mastra/memory": "0.0.2-alpha.26",
44
45
  "@mastra/rag": "0.0.2-alpha.30",
45
46
  "@mastra/github": "1.0.3-alpha.30",
46
- "@mastra/stabilityai": "1.0.1-alpha.21",
47
- "@mastra/engine": "0.0.5-alpha.40"
47
+ "@mastra/stabilityai": "1.0.1-alpha.21"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "npx tsc",