@mastra/dane 0.0.2-alpha.63 → 0.0.2-alpha.65

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.
@@ -0,0 +1,4 @@
1
+ export declare function linkChecker({ url }: {
2
+ url: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=link-checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-checker.d.ts","sourceRoot":"","sources":["../../src/commands/link-checker.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,iBAiBzD"}
@@ -0,0 +1,16 @@
1
+ import chalk from 'chalk';
2
+ import { mastra } from '../mastra/index.js';
3
+ export async function linkChecker({ url }) {
4
+ console.log(chalk.green("Hi! I'm Dane!"));
5
+ console.log(chalk.green('Lets check the links...\n'));
6
+ const workflow = mastra.getWorkflow('linkChecker');
7
+ const { start } = workflow.createRun();
8
+ const res = await start({
9
+ triggerData: {
10
+ channelId: process.env.LINK_CHECKER_CHANNEL_ID,
11
+ targetUrl: url,
12
+ },
13
+ });
14
+ console.log(res);
15
+ process.exit(0);
16
+ }
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { changelog } from './commands/changelog.js';
5
5
  import { commitMessageCommand } from './commands/commit-message.js';
6
6
  import { configCommand } from './commands/config.js';
7
7
  import { issueLabelerCommand } from './commands/issue-labeler.js';
8
+ import { linkChecker } from './commands/link-checker.js';
8
9
  import { message } from './commands/message.js';
9
10
  import { publishPackages } from './commands/publish-packages.js';
10
11
  import { telephone } from './commands/telephone-game.js';
@@ -24,4 +25,11 @@ program.addCommand(configCommand);
24
25
  program.command('publish').description('Publish packages to the registry').action(publishPackages);
25
26
  program.command('telephone-game').description('Play a classic game of telephone').action(telephone);
26
27
  program.command('changelog').description('Mastra Changelog').action(changelog);
28
+ program
29
+ .command('link-checker')
30
+ .description('Check for broken links')
31
+ .option('-u, --url <url>', 'URL to check')
32
+ .action(args => {
33
+ linkChecker({ url: args.url });
34
+ });
27
35
  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 daneLinkChecker: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
89
90
  export declare const daneChangeLog: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
90
91
  export declare const dane: Agent<{
91
92
  fsTool: import("@mastra/core").Tool<"fsTool", import("zod").ZodObject<{
@@ -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,aAAa,8EAcxB,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,eAAe,8EAa1B,CAAC;AAEH,eAAO,MAAM,aAAa,8EAcxB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDf,CAAC"}
@@ -48,6 +48,20 @@ export const danePackagePublisher = new Agent({
48
48
  activeDistTag,
49
49
  },
50
50
  });
51
+ export const daneLinkChecker = new Agent({
52
+ name: 'DaneLinkChecker',
53
+ instructions: `
54
+ You are Dane, the link checker for Mastra AI. You report on broken links whenever you see them.
55
+ Make sure to include the url in the message.
56
+
57
+ ## Style Guide
58
+ - Use active voice
59
+ - Keep descriptions concise but informative
60
+ - Avoid marketing language
61
+ - Link to relevant documentation
62
+ `,
63
+ model: getBaseModelConfig(),
64
+ });
51
65
  export const daneChangeLog = new Agent({
52
66
  name: 'DanePackagePublisher',
53
67
  instructions: `
@@ -280,6 +280,7 @@ export declare const mastra: Mastra<{
280
280
  packagePath: string;
281
281
  }>, import("@mastra/core").WorkflowContext<any>>>;
282
282
  }>;
283
+ daneLinkChecker: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
283
284
  daneIssueLabeler: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
284
285
  daneCommitMessage: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
285
286
  daneChangeLog: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
@@ -323,5 +324,15 @@ export declare const mastra: Mastra<{
323
324
  }, {
324
325
  channelId: string;
325
326
  }>>;
327
+ linkChecker: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
328
+ channelId: import("zod").ZodString;
329
+ targetUrl: import("zod").ZodString;
330
+ }, "strip", import("zod").ZodTypeAny, {
331
+ channelId: string;
332
+ targetUrl: string;
333
+ }, {
334
+ channelId: string;
335
+ targetUrl: string;
336
+ }>>;
326
337
  }, Record<string, import("@mastra/core").MastraVector>, Record<string, import("@mastra/core").MastraTTS>, import("@mastra/core").BaseLogger<import("@mastra/core").BaseLogMessage>>;
327
338
  //# 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;AAetC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mLAyBjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mastra/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAuBtC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mLA2BjB,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { Mastra } from '@mastra/core';
2
2
  import { PostgresEngine } from '@mastra/engine';
3
3
  import { UpstashKVMemory } from '@mastra/memory';
4
- import { dane, daneChangeLog, daneCommitMessage, daneIssueLabeler, danePackagePublisher } from './agents/index.js';
4
+ import { dane, daneChangeLog, daneCommitMessage, daneIssueLabeler, daneLinkChecker, danePackagePublisher, } from './agents/index.js';
5
5
  import { firecrawl } from './integrations/index.js';
6
6
  import { changelogWorkflow } from './workflows/changelog.js';
7
7
  import { messageWorkflow, githubIssueLabeler, commitMessageGenerator } from './workflows/index.js';
8
+ import { linkCheckerWorkflow } from './workflows/link-checker.js';
8
9
  import { packagePublisher } from './workflows/publish-packages.js';
9
10
  import { telephoneGameWorkflow } from './workflows/telephone-game.js';
10
11
  const engine = new PostgresEngine({
@@ -14,6 +15,7 @@ export const mastra = new Mastra({
14
15
  agents: {
15
16
  dane,
16
17
  danePackagePublisher,
18
+ daneLinkChecker,
17
19
  daneIssueLabeler,
18
20
  daneCommitMessage,
19
21
  daneChangeLog,
@@ -31,6 +33,7 @@ export const mastra = new Mastra({
31
33
  packagePublisher: packagePublisher,
32
34
  telephoneGame: telephoneGameWorkflow,
33
35
  changelog: changelogWorkflow,
36
+ linkChecker: linkCheckerWorkflow,
34
37
  },
35
38
  syncs: {
36
39
  ...firecrawl.getSyncs(),
@@ -0,0 +1,13 @@
1
+ import { Workflow } from '@mastra/core';
2
+ import { z } from 'zod';
3
+ export declare const linkCheckerWorkflow: Workflow<any, z.ZodObject<{
4
+ channelId: z.ZodString;
5
+ targetUrl: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ channelId: string;
8
+ targetUrl: string;
9
+ }, {
10
+ channelId: string;
11
+ targetUrl: string;
12
+ }>>;
13
+ //# sourceMappingURL=link-checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-checker.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/link-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,mBAAmB;;;;;;;;;GAM9B,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { Step, Workflow } from '@mastra/core';
2
+ import chalk from 'chalk';
3
+ import child_process from 'node:child_process';
4
+ import util from 'node:util';
5
+ import { z } from 'zod';
6
+ import { slack } from '../tools/mcp';
7
+ const exec = util.promisify(child_process.exec);
8
+ export const linkCheckerWorkflow = new Workflow({
9
+ name: 'link-checker',
10
+ triggerSchema: z.object({
11
+ channelId: z.string(),
12
+ targetUrl: z.string(),
13
+ }),
14
+ });
15
+ const linkSchema = z.object({
16
+ url: z.string(),
17
+ status: z.number(),
18
+ state: z.enum(['OK', 'BROKEN']),
19
+ parent: z.string().optional(),
20
+ });
21
+ const getBrokenLinks = new Step({
22
+ id: 'get-broken-links',
23
+ description: 'Get broken links',
24
+ inputSchema: z.object({
25
+ targetUrl: z.string(),
26
+ }),
27
+ outputSchema: z.object({
28
+ brokenLinks: z.array(linkSchema),
29
+ }),
30
+ execute: async ({ context }) => {
31
+ const targetUrl = context.targetUrl;
32
+ const res = await exec(`npx linkinator ${targetUrl} --format json`, {
33
+ encoding: 'utf-8',
34
+ });
35
+ if (res.stderr) {
36
+ throw new Error(res.stderr);
37
+ }
38
+ const data = JSON.parse(res.stdout);
39
+ const parsedData = linkSchema.array().parse(data.links);
40
+ return {
41
+ brokenLinks: parsedData.filter(link => link.state === 'BROKEN'),
42
+ };
43
+ },
44
+ });
45
+ const reportBrokenLinks = new Step({
46
+ id: 'report-broken-links',
47
+ description: 'Report broken links',
48
+ outputSchema: z.object({
49
+ message: z.string(),
50
+ }),
51
+ execute: async ({ context, mastra }) => {
52
+ const brokenLinks = context.machineContext?.getStepPayload('get-broken-links');
53
+ if (!brokenLinks) {
54
+ return {
55
+ message: 'No broken links found',
56
+ };
57
+ }
58
+ if (brokenLinks.brokenLinks.length === 0) {
59
+ return {
60
+ message: 'No broken links found',
61
+ };
62
+ }
63
+ try {
64
+ await slack.connect();
65
+ }
66
+ catch (e) {
67
+ console.error(e);
68
+ }
69
+ const triggerPayload = context.machineContext?.getStepPayload('trigger');
70
+ if (!triggerPayload) {
71
+ return {
72
+ message: 'Trigger payload not found',
73
+ };
74
+ }
75
+ const agent = mastra?.agents?.daneLinkChecker;
76
+ if (!agent) {
77
+ return {
78
+ message: 'Agent not found',
79
+ };
80
+ }
81
+ const tools = await slack.tools();
82
+ console.log(`🤖Generating...`);
83
+ const res = await agent.generate(`
84
+ Send this ${JSON.stringify(brokenLinks, null, 2)} to this slack channel: "${triggerPayload.channelId}" with the tool slack_post_message.
85
+ Format it in markdown so it displays nicely in slack.
86
+ `, {
87
+ toolsets: { slack: tools },
88
+ });
89
+ console.log(chalk.green(res.text));
90
+ return {
91
+ message: res.text,
92
+ };
93
+ },
94
+ });
95
+ linkCheckerWorkflow
96
+ .step(getBrokenLinks, {
97
+ variables: {
98
+ targetUrl: { step: 'trigger', path: 'targetUrl' },
99
+ },
100
+ })
101
+ .then(reportBrokenLinks)
102
+ .commit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/dane",
3
- "version": "0.0.2-alpha.63",
3
+ "version": "0.0.2-alpha.65",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -39,14 +39,14 @@
39
39
  "sqlite3": "^5.1.7",
40
40
  "typescript": "^5.5.4",
41
41
  "zod": "^3.24.0",
42
- "@mastra/core": "0.1.27-alpha.64",
43
- "@mastra/engine": "0.0.5-alpha.58",
44
- "@mastra/firecrawl": "1.0.4-alpha.52",
45
- "@mastra/github": "1.0.3-alpha.48",
46
- "@mastra/memory": "0.0.2-alpha.44",
47
- "@mastra/rag": "0.0.2-alpha.50",
48
- "@mastra/stabilityai": "1.0.1-alpha.39",
49
- "@mastra/mcp": "0.0.1-alpha.4"
42
+ "@mastra/core": "0.1.27-alpha.66",
43
+ "@mastra/engine": "0.0.5-alpha.60",
44
+ "@mastra/firecrawl": "1.0.4-alpha.54",
45
+ "@mastra/github": "1.0.3-alpha.50",
46
+ "@mastra/memory": "0.0.2-alpha.46",
47
+ "@mastra/rag": "0.0.2-alpha.52",
48
+ "@mastra/stabilityai": "1.0.1-alpha.41",
49
+ "@mastra/mcp": "0.0.1-alpha.6"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "npx tsc",