@mastra/dane 0.0.2-alpha.67 → 0.0.2-alpha.69
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/dist/commands/new-contributor-message.d.ts +2 -0
- package/dist/commands/new-contributor-message.d.ts.map +1 -0
- package/dist/commands/new-contributor-message.js +43 -0
- package/dist/index.js +2 -0
- package/dist/mastra/agents/index.d.ts.map +1 -1
- package/dist/mastra/agents/index.js +1 -7
- package/dist/mastra/agents/model.d.ts +7 -0
- package/dist/mastra/agents/model.d.ts.map +1 -0
- package/dist/mastra/agents/model.js +7 -0
- package/dist/mastra/agents/new-contributor.d.ts +3 -0
- package/dist/mastra/agents/new-contributor.d.ts.map +1 -0
- package/dist/mastra/agents/new-contributor.js +12 -0
- package/dist/mastra/index.d.ts +14 -0
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +4 -0
- package/dist/mastra/tools/pnpm.js +1 -1
- package/dist/mastra/workflows/first-contributor.d.ts +16 -0
- package/dist/mastra/workflows/first-contributor.d.ts.map +1 -0
- package/dist/mastra/workflows/first-contributor.js +122 -0
- package/dist/mastra/workflows/publish-packages.js +83 -16
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-contributor-message.d.ts","sourceRoot":"","sources":["../../src/commands/new-contributor-message.ts"],"names":[],"mappings":"AAIA,wBAAsB,qBAAqB,kBAkC1C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { mastra } from '../mastra';
|
|
3
|
+
export async function newContributorMessage() {
|
|
4
|
+
console.log(chalk.green("Hi! I'm Dane!"));
|
|
5
|
+
console.log(chalk.green('Let me create a welcoming message..\n'));
|
|
6
|
+
try {
|
|
7
|
+
const workflow = mastra.getWorkflow('githubFirstContributorMessage');
|
|
8
|
+
if (!workflow) {
|
|
9
|
+
console.error(chalk.red('First contributor workflow not found. Make sure it is properly set up.'));
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
const { start } = workflow.createRun();
|
|
13
|
+
const result = await start({
|
|
14
|
+
triggerData: {
|
|
15
|
+
pr_number: parseInt(process.env.PR_NUMBER, 10),
|
|
16
|
+
owner: process.env.OWNER,
|
|
17
|
+
repo: normalizeRepo(process.env.REPO),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
console.log(result);
|
|
21
|
+
const errorMessage = Object.values(result.results).find(result => result.status === 'failed')?.error;
|
|
22
|
+
if (result.results?.commit?.status !== 'success') {
|
|
23
|
+
console.error(chalk.red(`\n${errorMessage}`));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
console.log(chalk.green('\New contributor message generated and published successfully'));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error(chalk.red('Error:', error?.message || 'An unknown error occurred'));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extracts the repo name from owner/repo format provided by github
|
|
35
|
+
* @param repo - The repo name to normalize
|
|
36
|
+
* @returns The normalized repo name
|
|
37
|
+
*/
|
|
38
|
+
function normalizeRepo(repo) {
|
|
39
|
+
if (repo.includes('/')) {
|
|
40
|
+
return repo.split('/')[1] || repo;
|
|
41
|
+
}
|
|
42
|
+
return repo;
|
|
43
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { configCommand } from './commands/config.js';
|
|
|
7
7
|
import { issueLabelerCommand } from './commands/issue-labeler.js';
|
|
8
8
|
import { linkChecker } from './commands/link-checker.js';
|
|
9
9
|
import { message } from './commands/message.js';
|
|
10
|
+
import { newContributorMessage } from './commands/new-contributor-message.js';
|
|
10
11
|
import { publishPackages } from './commands/publish-packages.js';
|
|
11
12
|
import { telephone } from './commands/telephone-game.js';
|
|
12
13
|
dotenv.config();
|
|
@@ -25,6 +26,7 @@ program.addCommand(configCommand);
|
|
|
25
26
|
program.command('publish').description('Publish packages to the registry').action(publishPackages);
|
|
26
27
|
program.command('telephone-game').description('Play a classic game of telephone').action(telephone);
|
|
27
28
|
program.command('changelog').description('Mastra Changelog').action(changelog);
|
|
29
|
+
program.command('new-contributor').description('Create a new contributor message').action(newContributorMessage);
|
|
28
30
|
program
|
|
29
31
|
.command('link-checker')
|
|
30
32
|
.description('Check for broken links')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAarC,eAAO,MAAM,iBAAiB,8EAU5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,8EAO3B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc/B,CAAC;AAEH,eAAO,MAAM,eAAe,8EAa1B,CAAC;AAEH,eAAO,MAAM,aAAa,8EAcxB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDf,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Agent } from '@mastra/core';
|
|
2
|
-
import { config } from '../../config/index.js';
|
|
3
2
|
import { browserTool, googleSearch } from '../tools/browser.js';
|
|
4
3
|
import { listEvents } from '../tools/calendar.js';
|
|
5
4
|
import { crawl } from '../tools/crawl.js';
|
|
@@ -8,12 +7,7 @@ import { fsTool } from '../tools/fs.js';
|
|
|
8
7
|
import { imageTool } from '../tools/image.js';
|
|
9
8
|
import { readPDF } from '../tools/pdf.js';
|
|
10
9
|
import { activeDistTag, pnpmBuild, pnpmChangesetPublish, pnpmChangesetStatus } from '../tools/pnpm.js';
|
|
11
|
-
|
|
12
|
-
provider: 'ANTHROPIC',
|
|
13
|
-
toolChoice: 'auto',
|
|
14
|
-
name: 'claude-3-5-sonnet-20241022',
|
|
15
|
-
apiKey: config.getAnthropicApiKey(),
|
|
16
|
-
});
|
|
10
|
+
import { getBaseModelConfig } from './model';
|
|
17
11
|
export const daneCommitMessage = new Agent({
|
|
18
12
|
name: 'DaneCommitMessage',
|
|
19
13
|
instructions: `
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/model.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;CAK7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-contributor.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/new-contributor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrC,eAAO,MAAM,kBAAkB,WAS7B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
|
+
import { getBaseModelConfig } from './model';
|
|
3
|
+
export const daneNewContributor = new Agent({
|
|
4
|
+
name: 'DaneNewContributor',
|
|
5
|
+
instructions: `
|
|
6
|
+
You're Dane, the best GitHub open-source maintainer in the world.
|
|
7
|
+
Your tone is friendly and joyful.
|
|
8
|
+
When a new contributor creates a pull request, they see your message first.
|
|
9
|
+
`,
|
|
10
|
+
model: getBaseModelConfig(),
|
|
11
|
+
tools: {},
|
|
12
|
+
});
|
package/dist/mastra/index.d.ts
CHANGED
|
@@ -284,6 +284,7 @@ export declare const mastra: Mastra<{
|
|
|
284
284
|
daneIssueLabeler: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
285
285
|
daneCommitMessage: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
286
286
|
daneChangeLog: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
287
|
+
daneNewContributor: import("@mastra/core").Agent<{}>;
|
|
287
288
|
}, {
|
|
288
289
|
message: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
289
290
|
resourceid: import("zod").ZodString;
|
|
@@ -324,6 +325,19 @@ export declare const mastra: Mastra<{
|
|
|
324
325
|
}, {
|
|
325
326
|
channelId: string;
|
|
326
327
|
}>>;
|
|
328
|
+
githubFirstContributorMessage: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
329
|
+
repo: import("zod").ZodString;
|
|
330
|
+
owner: import("zod").ZodString;
|
|
331
|
+
pr_number: import("zod").ZodNumber;
|
|
332
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
333
|
+
repo: string;
|
|
334
|
+
owner: string;
|
|
335
|
+
pr_number: number;
|
|
336
|
+
}, {
|
|
337
|
+
repo: string;
|
|
338
|
+
owner: string;
|
|
339
|
+
pr_number: number;
|
|
340
|
+
}>>;
|
|
327
341
|
linkChecker: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
328
342
|
channelId: import("zod").ZodString;
|
|
329
343
|
targetUrl: import("zod").ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mastra/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mastra/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAyBtC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mLA6BjB,CAAC"}
|
package/dist/mastra/index.js
CHANGED
|
@@ -2,8 +2,10 @@ import { Mastra } from '@mastra/core';
|
|
|
2
2
|
import { PostgresEngine } from '@mastra/engine';
|
|
3
3
|
import { UpstashKVMemory } from '@mastra/memory';
|
|
4
4
|
import { dane, daneChangeLog, daneCommitMessage, daneIssueLabeler, daneLinkChecker, danePackagePublisher, } from './agents/index.js';
|
|
5
|
+
import { daneNewContributor } from './agents/new-contributor';
|
|
5
6
|
import { firecrawl } from './integrations/index.js';
|
|
6
7
|
import { changelogWorkflow } from './workflows/changelog.js';
|
|
8
|
+
import { githubFirstContributorMessage } from './workflows/first-contributor';
|
|
7
9
|
import { messageWorkflow, githubIssueLabeler, commitMessageGenerator } from './workflows/index.js';
|
|
8
10
|
import { linkCheckerWorkflow } from './workflows/link-checker.js';
|
|
9
11
|
import { packagePublisher } from './workflows/publish-packages.js';
|
|
@@ -19,6 +21,7 @@ export const mastra = new Mastra({
|
|
|
19
21
|
daneIssueLabeler,
|
|
20
22
|
daneCommitMessage,
|
|
21
23
|
daneChangeLog,
|
|
24
|
+
daneNewContributor,
|
|
22
25
|
},
|
|
23
26
|
engine,
|
|
24
27
|
memory: new UpstashKVMemory({
|
|
@@ -33,6 +36,7 @@ export const mastra = new Mastra({
|
|
|
33
36
|
packagePublisher: packagePublisher,
|
|
34
37
|
telephoneGame: telephoneGameWorkflow,
|
|
35
38
|
changelog: changelogWorkflow,
|
|
39
|
+
githubFirstContributorMessage: githubFirstContributorMessage,
|
|
36
40
|
linkChecker: linkCheckerWorkflow,
|
|
37
41
|
},
|
|
38
42
|
syncs: {
|
|
@@ -17,7 +17,7 @@ export const pnpmBuild = createTool({
|
|
|
17
17
|
}),
|
|
18
18
|
execute: async ({ context: { name, packagePath } }) => {
|
|
19
19
|
try {
|
|
20
|
-
console.log(chalk.green(
|
|
20
|
+
console.log(chalk.green(`\n Building: ${name} at ${packagePath}`));
|
|
21
21
|
const p = execa(`pnpm`, ['build'], {
|
|
22
22
|
stdio: 'inherit',
|
|
23
23
|
cwd: packagePath,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Workflow } from '@mastra/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const githubFirstContributorMessage: Workflow<any, z.ZodObject<{
|
|
4
|
+
repo: z.ZodString;
|
|
5
|
+
owner: z.ZodString;
|
|
6
|
+
pr_number: z.ZodNumber;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
repo: string;
|
|
9
|
+
owner: string;
|
|
10
|
+
pr_number: number;
|
|
11
|
+
}, {
|
|
12
|
+
repo: string;
|
|
13
|
+
owner: string;
|
|
14
|
+
pr_number: number;
|
|
15
|
+
}>>;
|
|
16
|
+
//# sourceMappingURL=first-contributor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-contributor.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/first-contributor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,6BAA6B;;;;;;;;;;;;GAOxC,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Step, Workflow } from '@mastra/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { github } from '../integrations/index.js';
|
|
4
|
+
export const githubFirstContributorMessage = new Workflow({
|
|
5
|
+
name: 'github-first-contributor-message',
|
|
6
|
+
triggerSchema: z.object({
|
|
7
|
+
repo: z.string(),
|
|
8
|
+
owner: z.string(),
|
|
9
|
+
pr_number: z.number(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
const getPullRequest = new Step({
|
|
13
|
+
id: 'getPullRequest',
|
|
14
|
+
outputSchema: z.object({
|
|
15
|
+
title: z.string(),
|
|
16
|
+
body: z.string(),
|
|
17
|
+
diff: z.string(),
|
|
18
|
+
}),
|
|
19
|
+
execute: async ({ context }) => {
|
|
20
|
+
const client = await github.getApiClient();
|
|
21
|
+
const pullRequest = await client.pullsGet({
|
|
22
|
+
path: {
|
|
23
|
+
owner: context?.machineContext?.triggerData?.owner,
|
|
24
|
+
repo: context?.machineContext?.triggerData?.repo,
|
|
25
|
+
pull_number: context?.machineContext?.triggerData?.pr_number,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
if (!pullRequest?.data) {
|
|
29
|
+
throw new Error('Pull request not found');
|
|
30
|
+
}
|
|
31
|
+
const response = await fetch(pullRequest.data.diff_url);
|
|
32
|
+
const diff = await response.text();
|
|
33
|
+
return {
|
|
34
|
+
title: pullRequest.data.title,
|
|
35
|
+
body: pullRequest.data.body || '',
|
|
36
|
+
diff,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const generateMessage = new Step({
|
|
41
|
+
id: 'message-generator',
|
|
42
|
+
outputSchema: z.object({
|
|
43
|
+
message: z.array(z.string()),
|
|
44
|
+
}),
|
|
45
|
+
execute: async ({ context, mastra }) => {
|
|
46
|
+
const parentStep = context?.machineContext?.stepResults?.getPullRequest;
|
|
47
|
+
if (!parentStep || parentStep.status !== 'success') {
|
|
48
|
+
return { message: [] };
|
|
49
|
+
}
|
|
50
|
+
const mastraDocsRes = await fetch('https://mastra.ai/llms.txt');
|
|
51
|
+
const mastraDocs = await mastraDocsRes.text();
|
|
52
|
+
const daneNewContributor = mastra?.agents?.daneNewContributor;
|
|
53
|
+
const res = await daneNewContributor?.generate(`
|
|
54
|
+
Hey Dane, given:
|
|
55
|
+
START TITLE
|
|
56
|
+
${parentStep?.payload?.title}
|
|
57
|
+
END TITLE
|
|
58
|
+
|
|
59
|
+
START BODY
|
|
60
|
+
${parentStep?.payload?.body}
|
|
61
|
+
END BODY
|
|
62
|
+
START DIFF
|
|
63
|
+
${parentStep?.payload?.diff}
|
|
64
|
+
END DIFF
|
|
65
|
+
|
|
66
|
+
I'll give you some more context about Mastra:
|
|
67
|
+
MASTRA DOCS
|
|
68
|
+
${mastraDocs}
|
|
69
|
+
END MASTRA DOCS
|
|
70
|
+
|
|
71
|
+
Write message to the contributor to thank them for their first contribution? And check if the following guidelines are followed, do not mention these checklist if they are actually checked:
|
|
72
|
+
- Check if the body matches the diff and is not empty
|
|
73
|
+
- Check if tests are added or updated
|
|
74
|
+
- check if the code looks similar to what's already written
|
|
75
|
+
- Ask if they have tested the changes on any of the examples
|
|
76
|
+
|
|
77
|
+
VERY IMPORTANT:
|
|
78
|
+
You should not summarize nor you should give advice on the code itself, only follow the guidelines.
|
|
79
|
+
|
|
80
|
+
The message should bes strucutred like:
|
|
81
|
+
an intro message to thank the user for their contribution
|
|
82
|
+
the checklist
|
|
83
|
+
and an outro that just says thank you again and that we will review it shortly. If there is no checklist we should skip thank you.
|
|
84
|
+
`, {
|
|
85
|
+
output: z.object({
|
|
86
|
+
intro: z.string(),
|
|
87
|
+
checklist: z.string().array(),
|
|
88
|
+
outro: z.string(),
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
if (!res) {
|
|
92
|
+
throw new Error(`We couldn't generate a message`);
|
|
93
|
+
}
|
|
94
|
+
return res.object;
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
const createMessage = new Step({
|
|
98
|
+
id: 'create-message',
|
|
99
|
+
execute: async ({ context }) => {
|
|
100
|
+
const parentStep = context?.machineContext?.stepResults?.['message-generator'];
|
|
101
|
+
if (!parentStep || parentStep.status !== 'success') {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const client = await github.getApiClient();
|
|
105
|
+
const res = await client.issuesCreateComment({
|
|
106
|
+
path: {
|
|
107
|
+
owner: context?.machineContext?.triggerData?.owner,
|
|
108
|
+
repo: context?.machineContext?.triggerData?.repo,
|
|
109
|
+
issue_number: context?.machineContext?.triggerData?.pr_number,
|
|
110
|
+
},
|
|
111
|
+
body: {
|
|
112
|
+
body: `${parentStep.payload.intro}
|
|
113
|
+
|
|
114
|
+
${parentStep.payload.checklist.map((s) => `- [ ] ${s}`).join('\n')}
|
|
115
|
+
|
|
116
|
+
${parentStep.payload.outro}`,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
console.log(res);
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
githubFirstContributorMessage.step(getPullRequest).then(generateMessage).then(createMessage).commit();
|
|
@@ -19,25 +19,42 @@ const getPacakgesToPublish = new Step({
|
|
|
19
19
|
throw new Error('Agent not found');
|
|
20
20
|
}
|
|
21
21
|
const result = await agent.generate(`
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Here is my project structure in my monorepo.
|
|
23
|
+
* My core modules are in the 'packages' directory.
|
|
24
|
+
* My integrations are in the 'integrations' directory.
|
|
25
|
+
* My deployers are in the 'deployers' directory.
|
|
26
|
+
|
|
27
|
+
Can you tell me which packages within these folders need to be published to npm?
|
|
28
|
+
`);
|
|
24
29
|
const resultObj = await agent.generate(`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
Can you format the following text with my described format?
|
|
31
|
+
|
|
32
|
+
Formatting Rules:
|
|
33
|
+
* If the text I am giving you says there are no publishable packages, return empty arrays.
|
|
34
|
+
* @mastra/core must be first.
|
|
35
|
+
* @mastra/deployer must be second.
|
|
36
|
+
* mastra must be third.
|
|
37
|
+
|
|
38
|
+
Text: ${result.text}
|
|
39
|
+
|
|
40
|
+
Very Important:
|
|
41
|
+
* Do not include packages if we do not need to build them.
|
|
42
|
+
* create-mastra is a package (not an integration) and should be listed in packages array.
|
|
43
|
+
* @mastra/deployers-{name} should be listed after packages.
|
|
44
|
+
* @mastra/dane should be listed after packages and integrations.
|
|
45
|
+
`, {
|
|
32
46
|
output: z.object({
|
|
33
47
|
packages: z.array(z.string()),
|
|
34
48
|
integrations: z.array(z.string()),
|
|
49
|
+
deployers: z.array(z.string()),
|
|
35
50
|
danePackage: z.string(),
|
|
36
51
|
}),
|
|
37
52
|
});
|
|
53
|
+
console.log(resultObj.object);
|
|
38
54
|
return {
|
|
39
55
|
packages: resultObj?.object?.packages,
|
|
40
56
|
integrations: resultObj?.object?.integrations,
|
|
57
|
+
deployers: resultObj?.object?.deployers,
|
|
41
58
|
danePackage: resultObj?.object?.danePackage,
|
|
42
59
|
};
|
|
43
60
|
},
|
|
@@ -65,6 +82,16 @@ const assemblePackages = new Step({
|
|
|
65
82
|
packagesToBuild.add(pkgPath);
|
|
66
83
|
});
|
|
67
84
|
}
|
|
85
|
+
if (payload?.deployers) {
|
|
86
|
+
payload.deployers.forEach((pkg) => {
|
|
87
|
+
let pkgName = pkg.replace('@mastra/deployer-', '');
|
|
88
|
+
if (pkgName === 'mastra') {
|
|
89
|
+
pkgName = 'cli';
|
|
90
|
+
}
|
|
91
|
+
const pkgPath = path.join(process.cwd(), 'deployers', pkgName);
|
|
92
|
+
packagesToBuild.add(pkgPath);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
68
95
|
if (payload?.integrations) {
|
|
69
96
|
const integrations = payload.integrations;
|
|
70
97
|
integrations.forEach((integration) => {
|
|
@@ -124,18 +151,52 @@ const buildPackages = new Step({
|
|
|
124
151
|
if (!agent) {
|
|
125
152
|
throw new Error('Agent not found');
|
|
126
153
|
}
|
|
154
|
+
console.log(chalk.green(`Building packages:`));
|
|
155
|
+
pkgSet.forEach((pkg) => {
|
|
156
|
+
console.log(chalk.green(pkg));
|
|
157
|
+
});
|
|
127
158
|
let res = await agent.generate(`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
159
|
+
Here are the packages that need to be built: ${pkgSet.join(',')}.
|
|
160
|
+
|
|
161
|
+
## Follow the rules:
|
|
162
|
+
* @mastra/core must be first.
|
|
163
|
+
* @mastra/deployer must be second.
|
|
164
|
+
* mastra must be third.
|
|
165
|
+
|
|
166
|
+
Packages found within the 'packages' directory should be built next in parallel.
|
|
167
|
+
Packages found within the 'integrations' directory should be built in parallel.
|
|
168
|
+
Packages found within the 'deployers' directory should be built in parallel.
|
|
169
|
+
|
|
170
|
+
Build @mastra/dane last.
|
|
171
|
+
`);
|
|
135
172
|
console.log(chalk.green(res.text));
|
|
136
173
|
return { packages: pkgSet };
|
|
137
174
|
},
|
|
138
175
|
});
|
|
176
|
+
const verifyBuild = new Step({
|
|
177
|
+
id: 'verifyBuild',
|
|
178
|
+
outputSchema: z.object({
|
|
179
|
+
packages: z.array(z.string()),
|
|
180
|
+
}),
|
|
181
|
+
execute: async ({ context }) => {
|
|
182
|
+
if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
|
|
183
|
+
return {
|
|
184
|
+
packages: [],
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
|
|
188
|
+
for (const pkg of pkgSet) {
|
|
189
|
+
if (!existsSync(`${pkg}/dist`)) {
|
|
190
|
+
console.error(chalk.red(`Failed to build ${pkg}.`));
|
|
191
|
+
throw new Error(`Failed to build ${pkg}.`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
console.log(pkgSet);
|
|
195
|
+
return {
|
|
196
|
+
packages: pkgSet,
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
});
|
|
139
200
|
const publishChangeset = new Step({
|
|
140
201
|
id: 'publishChangeset',
|
|
141
202
|
outputSchema: z.object({
|
|
@@ -190,6 +251,12 @@ packagePublisher
|
|
|
190
251
|
return (context.stepResults.assemblePackages?.status === 'success' &&
|
|
191
252
|
context.stepResults.assemblePackages?.payload?.packages.length > 0);
|
|
192
253
|
},
|
|
254
|
+
})
|
|
255
|
+
.then(verifyBuild, {
|
|
256
|
+
when: async ({ context }) => {
|
|
257
|
+
return (context.stepResults.buildPackages?.status === 'success' &&
|
|
258
|
+
context.stepResults.buildPackages?.payload?.packages.length > 0);
|
|
259
|
+
},
|
|
193
260
|
})
|
|
194
261
|
.then(publishChangeset, {
|
|
195
262
|
when: async ({ context }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/dane",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.69",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"typescript": "^5.5.4",
|
|
41
41
|
"zod": "^3.24.0",
|
|
42
42
|
"@mastra/core": "0.1.27-alpha.66",
|
|
43
|
-
"@mastra/
|
|
43
|
+
"@mastra/firecrawl": "1.0.4-alpha.54",
|
|
44
44
|
"@mastra/github": "1.0.3-alpha.50",
|
|
45
|
+
"@mastra/engine": "0.0.5-alpha.60",
|
|
46
|
+
"@mastra/rag": "0.0.2-alpha.52",
|
|
45
47
|
"@mastra/memory": "0.0.2-alpha.46",
|
|
46
48
|
"@mastra/stabilityai": "1.0.1-alpha.41",
|
|
47
|
-
"@mastra/firecrawl": "1.0.4-alpha.54",
|
|
48
|
-
"@mastra/rag": "0.0.2-alpha.52",
|
|
49
49
|
"@mastra/mcp": "0.0.1-alpha.6"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|