@mastra/dane 0.0.2-alpha.58 → 0.0.2-alpha.59
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/changelog.d.ts +2 -0
- package/dist/commands/changelog.d.ts.map +1 -0
- package/dist/commands/changelog.js +11 -0
- package/dist/index.js +2 -0
- package/dist/mastra/agents/index.d.ts +1 -0
- package/dist/mastra/agents/index.d.ts.map +1 -1
- package/dist/mastra/agents/index.js +15 -0
- package/dist/mastra/index.d.ts +8 -0
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +4 -1
- package/dist/mastra/tools/mcp.d.ts +3 -0
- package/dist/mastra/tools/mcp.d.ts.map +1 -0
- package/dist/mastra/tools/mcp.js +12 -0
- package/dist/mastra/workflows/changelog.d.ts +10 -0
- package/dist/mastra/workflows/changelog.d.ts.map +1 -0
- package/dist/mastra/workflows/changelog.js +160 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/commands/changelog.ts"],"names":[],"mappings":"AAIA,wBAAsB,SAAS,kBAa9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { mastra } from '../mastra/index.js';
|
|
3
|
+
export async function changelog() {
|
|
4
|
+
console.log(chalk.green("Hi! I'm Dane!"));
|
|
5
|
+
console.log(chalk.green('Lets make the changelog..\n'));
|
|
6
|
+
const workflow = mastra.getWorkflow('changelog');
|
|
7
|
+
const { start } = workflow.createRun();
|
|
8
|
+
const res = await start();
|
|
9
|
+
console.log(res);
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import dotenv from 'dotenv';
|
|
4
|
+
import { changelog } from './commands/changelog.js';
|
|
4
5
|
import { commitMessageCommand } from './commands/commit-message.js';
|
|
5
6
|
import { configCommand } from './commands/config.js';
|
|
6
7
|
import { issueLabelerCommand } from './commands/issue-labeler.js';
|
|
@@ -22,4 +23,5 @@ program
|
|
|
22
23
|
program.addCommand(configCommand);
|
|
23
24
|
program.command('publish').description('Publish packages to the registry').action(publishPackages);
|
|
24
25
|
program.command('telephone-game').description('Play a classic game of telephone').action(telephone);
|
|
26
|
+
program.command('changelog').description('Mastra Changelog').action(changelog);
|
|
25
27
|
program.parse(process.argv);
|
|
@@ -86,6 +86,7 @@ export declare const danePackagePublisher: Agent<{
|
|
|
86
86
|
packagePath: string;
|
|
87
87
|
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
88
88
|
}>;
|
|
89
|
+
export declare const daneChangeLog: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
89
90
|
export declare const dane: Agent<{
|
|
90
91
|
fsTool: import("@mastra/core").Tool<"fsTool", import("zod").ZodObject<{
|
|
91
92
|
action: import("zod").ZodString;
|
|
@@ -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;AAmBrC,eAAO,MAAM,iBAAiB,8EAU5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,8EAO3B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc/B,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDf,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;AAmBrC,eAAO,MAAM,iBAAiB,8EAU5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,8EAO3B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc/B,CAAC;AAEH,eAAO,MAAM,aAAa,8EAcxB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDf,CAAC"}
|
|
@@ -48,6 +48,21 @@ export const danePackagePublisher = new Agent({
|
|
|
48
48
|
activeDistTag,
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
|
+
export const daneChangeLog = new Agent({
|
|
52
|
+
name: 'DanePackagePublisher',
|
|
53
|
+
instructions: `
|
|
54
|
+
You are Dane, the changelog writer for Mastra AI. Every week we need to write a changelog for the Mastra AI project.
|
|
55
|
+
## Style Guide
|
|
56
|
+
- Use active voice
|
|
57
|
+
- Lead with the change, not the PR number
|
|
58
|
+
- Include PR numbers in parentheses at end of line
|
|
59
|
+
- Keep descriptions concise but informative
|
|
60
|
+
- Avoid marketing language
|
|
61
|
+
- Link to relevant documentation
|
|
62
|
+
- Use consistent formatting for code references
|
|
63
|
+
`,
|
|
64
|
+
model: getBaseModelConfig(),
|
|
65
|
+
});
|
|
51
66
|
export const dane = new Agent({
|
|
52
67
|
name: 'Dane',
|
|
53
68
|
instructions: `
|
package/dist/mastra/index.d.ts
CHANGED
|
@@ -282,6 +282,7 @@ export declare const mastra: Mastra<{
|
|
|
282
282
|
}>;
|
|
283
283
|
daneIssueLabeler: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
284
284
|
daneCommitMessage: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
285
|
+
daneChangeLog: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
285
286
|
}, {
|
|
286
287
|
message: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
287
288
|
resourceid: import("zod").ZodString;
|
|
@@ -315,5 +316,12 @@ export declare const mastra: Mastra<{
|
|
|
315
316
|
}>>;
|
|
316
317
|
packagePublisher: import("@mastra/core").Workflow<any, any>;
|
|
317
318
|
telephoneGame: import("@mastra/core").Workflow<any, any>;
|
|
319
|
+
changelog: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
320
|
+
channelId: import("zod").ZodString;
|
|
321
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
322
|
+
channelId: string;
|
|
323
|
+
}, {
|
|
324
|
+
channelId: string;
|
|
325
|
+
}>>;
|
|
318
326
|
}, Record<string, import("@mastra/core").MastraVector>, Record<string, import("@mastra/core").MastraTTS>, import("@mastra/core").BaseLogger<import("@mastra/core").BaseLogMessage>>;
|
|
319
327
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;AAetC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mLAyBjB,CAAC"}
|
package/dist/mastra/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Mastra } from '@mastra/core';
|
|
2
2
|
import { PostgresEngine } from '@mastra/engine';
|
|
3
3
|
import { UpstashKVMemory } from '@mastra/memory';
|
|
4
|
-
import { dane, daneCommitMessage, daneIssueLabeler, danePackagePublisher } from './agents/index.js';
|
|
4
|
+
import { dane, daneChangeLog, daneCommitMessage, daneIssueLabeler, danePackagePublisher } from './agents/index.js';
|
|
5
5
|
import { firecrawl } from './integrations/index.js';
|
|
6
|
+
import { changelogWorkflow } from './workflows/changelog.js';
|
|
6
7
|
import { messageWorkflow, githubIssueLabeler, commitMessageGenerator } from './workflows/index.js';
|
|
7
8
|
import { packagePublisher } from './workflows/publish-packages.js';
|
|
8
9
|
import { telephoneGameWorkflow } from './workflows/telephone-game.js';
|
|
@@ -15,6 +16,7 @@ export const mastra = new Mastra({
|
|
|
15
16
|
danePackagePublisher,
|
|
16
17
|
daneIssueLabeler,
|
|
17
18
|
daneCommitMessage,
|
|
19
|
+
daneChangeLog,
|
|
18
20
|
},
|
|
19
21
|
engine,
|
|
20
22
|
memory: new UpstashKVMemory({
|
|
@@ -28,6 +30,7 @@ export const mastra = new Mastra({
|
|
|
28
30
|
commitMessage: commitMessageGenerator,
|
|
29
31
|
packagePublisher: packagePublisher,
|
|
30
32
|
telephoneGame: telephoneGameWorkflow,
|
|
33
|
+
changelog: changelogWorkflow,
|
|
31
34
|
},
|
|
32
35
|
syncs: {
|
|
33
36
|
...firecrawl.getSyncs(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,KAAK,iBAUhB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MastraMCPClient } from '@mastra/mcp';
|
|
2
|
+
export const slack = new MastraMCPClient({
|
|
3
|
+
name: 'Slack',
|
|
4
|
+
server: {
|
|
5
|
+
command: '/usr/local/bin/docker',
|
|
6
|
+
args: ['run', '-i', '--rm', '-e', 'SLACK_BOT_TOKEN', '-e', 'SLACK_TEAM_ID', 'mcp/slack'],
|
|
7
|
+
env: {
|
|
8
|
+
SLACK_BOT_TOKEN: process.env.SLACK_BOT_TOKEN,
|
|
9
|
+
SLACK_TEAM_ID: process.env.SLACK_TEAM_ID,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Workflow } from '@mastra/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const changelogWorkflow: Workflow<any, z.ZodObject<{
|
|
4
|
+
channelId: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
channelId: string;
|
|
7
|
+
}, {
|
|
8
|
+
channelId: string;
|
|
9
|
+
}>>;
|
|
10
|
+
//# sourceMappingURL=changelog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/changelog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB;;;;;;GAK5B,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Step, Workflow } from '@mastra/core';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { execa } from 'execa';
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { slack } from '../tools/mcp';
|
|
7
|
+
export const changelogWorkflow = new Workflow({
|
|
8
|
+
name: 'changelog',
|
|
9
|
+
triggerSchema: z.object({
|
|
10
|
+
channelId: z.string(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
const stepA1 = new Step({
|
|
14
|
+
id: 'stepA1',
|
|
15
|
+
description: 'Get a git diff',
|
|
16
|
+
outputSchema: z.object({
|
|
17
|
+
message: z.string(),
|
|
18
|
+
}),
|
|
19
|
+
execute: async () => {
|
|
20
|
+
console.log('SUH');
|
|
21
|
+
// For today
|
|
22
|
+
try {
|
|
23
|
+
await slack.connect();
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
console.error(e);
|
|
27
|
+
}
|
|
28
|
+
const today = new Date().toISOString().split('T')[0];
|
|
29
|
+
console.log(today);
|
|
30
|
+
// For 7 days ago
|
|
31
|
+
const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
|
32
|
+
console.log(weekAgo);
|
|
33
|
+
const cwd = process.cwd();
|
|
34
|
+
console.log(cwd);
|
|
35
|
+
const args = [
|
|
36
|
+
'--no-pager',
|
|
37
|
+
'diff',
|
|
38
|
+
'--unified=1', // Reduced context to 1 line
|
|
39
|
+
'--no-prefix',
|
|
40
|
+
'--color=never',
|
|
41
|
+
'--shortstat', // Get size first to check
|
|
42
|
+
`main@{${weekAgo}}`,
|
|
43
|
+
`main@{${today}}`,
|
|
44
|
+
'--',
|
|
45
|
+
'packages/**',
|
|
46
|
+
// 'docs/**'
|
|
47
|
+
];
|
|
48
|
+
console.log(args);
|
|
49
|
+
const p = execa('git', args, {
|
|
50
|
+
cwd,
|
|
51
|
+
});
|
|
52
|
+
try {
|
|
53
|
+
const diff = await p;
|
|
54
|
+
return {
|
|
55
|
+
message: diff.stdout,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
console.error(e);
|
|
60
|
+
return {
|
|
61
|
+
message: 'Error, do not compute',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const stepA2 = new Step({
|
|
67
|
+
id: 'stepA2',
|
|
68
|
+
description: 'Make changelog',
|
|
69
|
+
outputSchema: z.object({
|
|
70
|
+
message: z.string(),
|
|
71
|
+
}),
|
|
72
|
+
execute: async ({ context, mastra }) => {
|
|
73
|
+
if (context.machineContext?.stepResults.stepA1?.status !== 'success') {
|
|
74
|
+
throw new Error('Message not found');
|
|
75
|
+
}
|
|
76
|
+
const agent = mastra?.agents?.daneChangeLog;
|
|
77
|
+
if (!agent) {
|
|
78
|
+
throw new Error('LLM not found');
|
|
79
|
+
}
|
|
80
|
+
const today = new Date().toISOString().split('T')[0];
|
|
81
|
+
const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
|
82
|
+
if (existsSync(`changelog-${today}`)) {
|
|
83
|
+
return {
|
|
84
|
+
message: readFileSync(`changelog-${today}`, 'utf-8'),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const prompt = `
|
|
88
|
+
Time: ${weekAgo} - ${today}
|
|
89
|
+
|
|
90
|
+
Git diff to generate from: ${context.machineContext.stepResults.stepA1.payload.message}
|
|
91
|
+
# Task
|
|
92
|
+
1. create a structured narrative changelog that highlights key updates and improvements.
|
|
93
|
+
2. Include what packages were changed
|
|
94
|
+
|
|
95
|
+
## Structure
|
|
96
|
+
|
|
97
|
+
1. Opening
|
|
98
|
+
- Brief welcome/context (1-2 sentences)
|
|
99
|
+
- Time period covered
|
|
100
|
+
|
|
101
|
+
2. Major Updates (3-4 key highlights)
|
|
102
|
+
- Lead with the most impactful changes
|
|
103
|
+
- Include brief technical context where needed
|
|
104
|
+
- Reference relevant PR numbers
|
|
105
|
+
- Link to examples/docs where applicable
|
|
106
|
+
|
|
107
|
+
3. Technical Improvements
|
|
108
|
+
- Group related changes
|
|
109
|
+
- Focus on developer impact
|
|
110
|
+
- Include code snippets if helpful
|
|
111
|
+
|
|
112
|
+
4. Documentation & Examples
|
|
113
|
+
- New guides/tutorials
|
|
114
|
+
- Updated examples
|
|
115
|
+
- API documentation changes
|
|
116
|
+
|
|
117
|
+
5. Bug Fixes & Infrastructure
|
|
118
|
+
- Notable bug fixes
|
|
119
|
+
- Build/deployment improvements
|
|
120
|
+
- Performance optimizations
|
|
121
|
+
`;
|
|
122
|
+
console.log(chalk.green(`Generating...`));
|
|
123
|
+
const result = await agent.generate(prompt);
|
|
124
|
+
console.log(chalk.green(result.text));
|
|
125
|
+
writeFileSync(`changelog-${today}`, result.text);
|
|
126
|
+
return {
|
|
127
|
+
message: result.text,
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
const stepA3 = new Step({
|
|
132
|
+
id: 'stepA3',
|
|
133
|
+
description: 'Send to slack',
|
|
134
|
+
execute: async ({ context, mastra }) => {
|
|
135
|
+
if (context.machineContext?.stepResults.stepA2?.status !== 'success') {
|
|
136
|
+
throw new Error('Message not found');
|
|
137
|
+
}
|
|
138
|
+
const agent = mastra?.agents?.daneChangeLog;
|
|
139
|
+
if (!agent) {
|
|
140
|
+
throw new Error('LLM not found');
|
|
141
|
+
}
|
|
142
|
+
const message = context.machineContext.stepResults.stepA2.payload.message;
|
|
143
|
+
try {
|
|
144
|
+
const tools = await slack.tools();
|
|
145
|
+
const channelId = context.machineContext.triggerData.channelId;
|
|
146
|
+
await agent.generate(`
|
|
147
|
+
Send this ${message} to this slack channel: "${channelId}" with the tool slack_post_message
|
|
148
|
+
`, {
|
|
149
|
+
toolsets: {
|
|
150
|
+
slack: tools,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
await slack.disconnect();
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
console.error(e);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
changelogWorkflow.step(stepA1).then(stepA2).then(stepA3).commit();
|
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.59",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -44,8 +44,9 @@
|
|
|
44
44
|
"@mastra/firecrawl": "1.0.4-alpha.51",
|
|
45
45
|
"@mastra/github": "1.0.3-alpha.48",
|
|
46
46
|
"@mastra/memory": "0.0.2-alpha.44",
|
|
47
|
-
"@mastra/
|
|
48
|
-
"@mastra/
|
|
47
|
+
"@mastra/stabilityai": "1.0.1-alpha.39",
|
|
48
|
+
"@mastra/mcp": "0.0.1-alpha.4",
|
|
49
|
+
"@mastra/rag": "0.0.2-alpha.49"
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
52
|
"build": "npx tsc",
|