@mastra/codemod 0.0.0-refactor-agent-information-for-recomposable-ui-20251112151814 → 0.0.0-trace-timeline-update-20251121114225

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mastra/codemod
2
2
 
3
- ## 0.0.0-refactor-agent-information-for-recomposable-ui-20251112151814
3
+ ## 0.0.0-trace-timeline-update-20251121114225
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,10 +8,18 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
+ - Fix `mastra-required-id`, `mcp-get-toolsets`, and `mcp-get-tools` codemods to add missing imports and instances. ([#10221](https://github.com/mastra-ai/mastra/pull/10221))
12
+
11
13
  - - Improve existing codemods ([#9959](https://github.com/mastra-ai/mastra/pull/9959))
12
14
  - Make package ESM-only
13
15
  - Add new codemods
14
16
 
17
+ ## 0.1.0-beta.2
18
+
19
+ ### Patch Changes
20
+
21
+ - Fix `mastra-required-id`, `mcp-get-toolsets`, and `mcp-get-tools` codemods to add missing imports and instances. ([#10221](https://github.com/mastra-ai/mastra/pull/10221))
22
+
15
23
  ## 0.1.0-beta.1
16
24
 
17
25
  ### Patch Changes
@@ -9,7 +9,9 @@ import {
9
9
  // src/codemods/v1/mcp-get-tools.ts
10
10
  var mcp_get_tools_default = createTransformer((_fileInfo, _api, _options, context) => {
11
11
  const { j, root } = context;
12
- const mcpInstances = trackClassInstances(j, root, "MCPServer");
12
+ const mcpServerInstances = trackClassInstances(j, root, "MCPServer");
13
+ const mcpClientInstances = trackClassInstances(j, root, "MCPClient");
14
+ const mcpInstances = /* @__PURE__ */ new Set([...mcpServerInstances, ...mcpClientInstances]);
13
15
  const count = renameMethod(j, root, mcpInstances, "getTools", "listTools");
14
16
  if (count > 0) {
15
17
  context.hasChanges = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/codemods/v1/mcp-get-tools.ts"],"sourcesContent":["import { createTransformer } from '../lib/create-transformer';\nimport { trackClassInstances, renameMethod } from '../lib/utils';\n\n/**\n * Transforms MCPServer getTools method to listTools:\n * - mcp.getTools() → mcp.listTools()\n *\n * Only transforms methods on variables that were instantiated with `new MCPServer(...)`\n */\nexport default createTransformer((_fileInfo, _api, _options, context) => {\n const { j, root } = context;\n\n // Track MCPServer instances and rename method in a single optimized pass\n const mcpInstances = trackClassInstances(j, root, 'MCPServer');\n const count = renameMethod(j, root, mcpInstances, 'getTools', 'listTools');\n\n if (count > 0) {\n context.hasChanges = true;\n context.messages.push(`Transformed MCPServer method: getTools → listTools`);\n }\n});\n"],"mappings":";;;;;;;;;AASA,IAAO,wBAAQ,kBAAkB,CAAC,WAAW,MAAM,UAAU,YAAY;AACvE,QAAM,EAAE,GAAG,KAAK,IAAI;AAGpB,QAAM,eAAe,oBAAoB,GAAG,MAAM,WAAW;AAC7D,QAAM,QAAQ,aAAa,GAAG,MAAM,cAAc,YAAY,WAAW;AAEzE,MAAI,QAAQ,GAAG;AACb,YAAQ,aAAa;AACrB,YAAQ,SAAS,KAAK,yDAAoD;AAAA,EAC5E;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/codemods/v1/mcp-get-tools.ts"],"sourcesContent":["import { createTransformer } from '../lib/create-transformer';\nimport { trackClassInstances, renameMethod } from '../lib/utils';\n\n/**\n * Transforms MCPServer and MCPClient getTools method to listTools:\n * - mcp.getTools() → mcp.listTools()\n *\n * Only transforms methods on variables that were instantiated with `new MCPServer(...)` or `new MCPClient(...)`\n */\nexport default createTransformer((_fileInfo, _api, _options, context) => {\n const { j, root } = context;\n\n // Track MCPServer and MCPClient instances and rename method in a single optimized pass\n const mcpServerInstances = trackClassInstances(j, root, 'MCPServer');\n const mcpClientInstances = trackClassInstances(j, root, 'MCPClient');\n const mcpInstances = new Set([...mcpServerInstances, ...mcpClientInstances]);\n const count = renameMethod(j, root, mcpInstances, 'getTools', 'listTools');\n\n if (count > 0) {\n context.hasChanges = true;\n context.messages.push(`Transformed MCPServer method: getTools → listTools`);\n }\n});\n"],"mappings":";;;;;;;;;AASA,IAAO,wBAAQ,kBAAkB,CAAC,WAAW,MAAM,UAAU,YAAY;AACvE,QAAM,EAAE,GAAG,KAAK,IAAI;AAGpB,QAAM,qBAAqB,oBAAoB,GAAG,MAAM,WAAW;AACnE,QAAM,qBAAqB,oBAAoB,GAAG,MAAM,WAAW;AACnE,QAAM,eAAe,oBAAI,IAAI,CAAC,GAAG,oBAAoB,GAAG,kBAAkB,CAAC;AAC3E,QAAM,QAAQ,aAAa,GAAG,MAAM,cAAc,YAAY,WAAW;AAEzE,MAAI,QAAQ,GAAG;AACb,YAAQ,aAAa;AACrB,YAAQ,SAAS,KAAK,yDAAoD;AAAA,EAC5E;AACF,CAAC;","names":[]}
@@ -9,7 +9,9 @@ import {
9
9
  // src/codemods/v1/mcp-get-toolsets.ts
10
10
  var mcp_get_toolsets_default = createTransformer((_fileInfo, _api, _options, context) => {
11
11
  const { j, root } = context;
12
- const mcpInstances = trackClassInstances(j, root, "MCPServer");
12
+ const mcpServerInstances = trackClassInstances(j, root, "MCPServer");
13
+ const mcpClientInstances = trackClassInstances(j, root, "MCPClient");
14
+ const mcpInstances = /* @__PURE__ */ new Set([...mcpServerInstances, ...mcpClientInstances]);
13
15
  const count = renameMethod(j, root, mcpInstances, "getToolsets", "listToolsets");
14
16
  if (count > 0) {
15
17
  context.hasChanges = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/codemods/v1/mcp-get-toolsets.ts"],"sourcesContent":["import { createTransformer } from '../lib/create-transformer';\nimport { trackClassInstances, renameMethod } from '../lib/utils';\n\n/**\n * Transforms MCPServer getToolsets method to listToolsets:\n * - mcp.getToolsets() → mcp.listToolsets()\n *\n * Only transforms methods on variables that were instantiated with `new MCPServer(...)`\n */\nexport default createTransformer((_fileInfo, _api, _options, context) => {\n const { j, root } = context;\n\n // Track MCPServer instances and rename method in a single optimized pass\n const mcpInstances = trackClassInstances(j, root, 'MCPServer');\n const count = renameMethod(j, root, mcpInstances, 'getToolsets', 'listToolsets');\n\n if (count > 0) {\n context.hasChanges = true;\n context.messages.push(`Transformed MCPServer method: getToolsets → listToolsets`);\n }\n});\n"],"mappings":";;;;;;;;;AASA,IAAO,2BAAQ,kBAAkB,CAAC,WAAW,MAAM,UAAU,YAAY;AACvE,QAAM,EAAE,GAAG,KAAK,IAAI;AAGpB,QAAM,eAAe,oBAAoB,GAAG,MAAM,WAAW;AAC7D,QAAM,QAAQ,aAAa,GAAG,MAAM,cAAc,eAAe,cAAc;AAE/E,MAAI,QAAQ,GAAG;AACb,YAAQ,aAAa;AACrB,YAAQ,SAAS,KAAK,+DAA0D;AAAA,EAClF;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/codemods/v1/mcp-get-toolsets.ts"],"sourcesContent":["import { createTransformer } from '../lib/create-transformer';\nimport { trackClassInstances, renameMethod } from '../lib/utils';\n\n/**\n * Transforms MCPServer and MCPClient getToolsets method to listToolsets:\n * - mcp.getToolsets() → mcp.listToolsets()\n *\n * Only transforms methods on variables that were instantiated with `new MCPServer(...)` or `new MCPClient(...)`\n */\nexport default createTransformer((_fileInfo, _api, _options, context) => {\n const { j, root } = context;\n\n // Track MCPServer and MCPClient instances and rename method in a single optimized pass\n const mcpServerInstances = trackClassInstances(j, root, 'MCPServer');\n const mcpClientInstances = trackClassInstances(j, root, 'MCPClient');\n const mcpInstances = new Set([...mcpServerInstances, ...mcpClientInstances]);\n const count = renameMethod(j, root, mcpInstances, 'getToolsets', 'listToolsets');\n\n if (count > 0) {\n context.hasChanges = true;\n context.messages.push(`Transformed MCPServer method: getToolsets → listToolsets`);\n }\n});\n"],"mappings":";;;;;;;;;AASA,IAAO,2BAAQ,kBAAkB,CAAC,WAAW,MAAM,UAAU,YAAY;AACvE,QAAM,EAAE,GAAG,KAAK,IAAI;AAGpB,QAAM,qBAAqB,oBAAoB,GAAG,MAAM,WAAW;AACnE,QAAM,qBAAqB,oBAAoB,GAAG,MAAM,WAAW;AACnE,QAAM,eAAe,oBAAI,IAAI,CAAC,GAAG,oBAAoB,GAAG,kBAAkB,CAAC;AAC3E,QAAM,QAAQ,aAAa,GAAG,MAAM,cAAc,eAAe,cAAc;AAE/E,MAAI,QAAQ,GAAG;AACb,YAAQ,aAAa;AACrB,YAAQ,SAAS,KAAK,+DAA0D;AAAA,EAClF;AACF,CAAC;","names":[]}
@@ -15,6 +15,7 @@ var mastra_required_id_default = createTransformer((fileInfo, api, options, cont
15
15
  "D1Store",
16
16
  "MongoDBStore",
17
17
  "DynamoDBStore",
18
+ "LibSQLVector",
18
19
  "PgVector",
19
20
  "ChromaVector",
20
21
  "PineconeVector",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/codemods/v1/not-implemented/mastra-required-id.ts"],"sourcesContent":["/* eslint-disable no-warning-comments */\nimport { insertCommentOnce } from '../../lib/add-comment';\nimport { createTransformer } from '../../lib/create-transformer';\n\n/**\n * Adds FIXME comments to Mastra primitives that now require an `id` parameter.\n * This includes storages, vector stores, agents, workflows, tools, scorers, and MCP servers.\n *\n * Before:\n * const agent = new Agent({ name: 'Support Agent' });\n * const tool = createTool({ description: 'Get weather' });\n *\n * After:\n * /* FIXME(mastra): Add a unique `id` parameter. See: ... *\\/\n * const agent = new Agent({ name: 'Support Agent' });\n * /* FIXME(mastra): Add a unique `id` parameter. See: ... *\\/\n * const tool = createTool({ description: 'Get weather' });\n */\nexport default createTransformer((fileInfo, api, options, context) => {\n const { j, root } = context;\n\n const COMMENT_MESSAGE =\n 'FIXME(mastra): Add a unique `id` parameter. See: https://mastra.ai/guides/v1/migrations/upgrade-to-v1/mastra#required-id-parameter-for-all-mastra-primitives';\n\n // List of class names that require id\n const storageClasses = [\n 'LibSQLStore',\n 'PostgresStore',\n 'D1Store',\n 'MongoDBStore',\n 'DynamoDBStore',\n 'PgVector',\n 'ChromaVector',\n 'PineconeVector',\n 'QdrantVector',\n 'LanceVector',\n 'Agent',\n 'MCPServer',\n ];\n\n // List of function names that require id\n const createFunctions = ['createWorkflow', 'createTool', 'createScorer'];\n\n // Find NewExpression for classes\n root.find(j.NewExpression).forEach(path => {\n if (path.value.callee.type === 'Identifier') {\n const className = path.value.callee.name;\n\n if (storageClasses.includes(className)) {\n // Check if the config already has an id property\n const hasId = path.value.arguments.some(arg => {\n if (arg.type === 'ObjectExpression') {\n return arg.properties?.some(\n prop =>\n (prop.type === 'Property' || prop.type === 'ObjectProperty') &&\n prop.key?.type === 'Identifier' &&\n prop.key.name === 'id',\n );\n }\n return false;\n });\n\n if (!hasId) {\n // Find the parent statement to add comment\n let parent = path.parent;\n const statementTypes = new Set([\n 'VariableDeclaration',\n 'ExpressionStatement',\n 'ReturnStatement',\n 'ExportDefaultDeclaration',\n 'ExportNamedDeclaration',\n 'Program',\n ]);\n\n while (parent && !statementTypes.has(parent.value.type)) {\n parent = parent.parent;\n }\n\n if (parent && parent.value) {\n // For export declarations, add comment to the export itself\n let targetNode = parent.value;\n if (\n targetNode.type !== 'ExportDefaultDeclaration' &&\n targetNode.type !== 'ExportNamedDeclaration' &&\n parent.parent &&\n (parent.parent.value.type === 'ExportDefaultDeclaration' ||\n parent.parent.value.type === 'ExportNamedDeclaration')\n ) {\n targetNode = parent.parent.value;\n }\n\n const added = insertCommentOnce(targetNode, j, COMMENT_MESSAGE);\n if (added) {\n context.hasChanges = true;\n }\n }\n }\n }\n }\n });\n\n // Find CallExpression for create functions\n root.find(j.CallExpression).forEach(path => {\n if (path.value.callee.type === 'Identifier') {\n const functionName = path.value.callee.name;\n\n if (createFunctions.includes(functionName)) {\n // Check if the config already has an id property\n const hasId = path.value.arguments.some(arg => {\n if (arg.type === 'ObjectExpression') {\n return arg.properties?.some(\n prop =>\n (prop.type === 'Property' || prop.type === 'ObjectProperty') &&\n prop.key?.type === 'Identifier' &&\n prop.key.name === 'id',\n );\n }\n return false;\n });\n\n if (!hasId) {\n // Find the parent statement to add comment\n let parent = path.parent;\n const statementTypes = new Set([\n 'VariableDeclaration',\n 'ExpressionStatement',\n 'ReturnStatement',\n 'ExportDefaultDeclaration',\n 'ExportNamedDeclaration',\n 'Program',\n ]);\n\n while (parent && !statementTypes.has(parent.value.type)) {\n parent = parent.parent;\n }\n\n if (parent && parent.value) {\n // For export declarations, add comment to the export itself\n let targetNode = parent.value;\n if (\n targetNode.type !== 'ExportDefaultDeclaration' &&\n targetNode.type !== 'ExportNamedDeclaration' &&\n parent.parent &&\n (parent.parent.value.type === 'ExportDefaultDeclaration' ||\n parent.parent.value.type === 'ExportNamedDeclaration')\n ) {\n targetNode = parent.parent.value;\n }\n\n const added = insertCommentOnce(targetNode, j, COMMENT_MESSAGE);\n if (added) {\n context.hasChanges = true;\n }\n }\n }\n }\n }\n });\n\n if (context.hasChanges) {\n context.messages.push(`Not Implemented ${fileInfo.path}: Mastra primitives now require a unique id parameter.`);\n }\n});\n"],"mappings":";;;;;;;;AAkBA,IAAO,6BAAQ,kBAAkB,CAAC,UAAU,KAAK,SAAS,YAAY;AACpE,QAAM,EAAE,GAAG,KAAK,IAAI;AAEpB,QAAM,kBACJ;AAGF,QAAM,iBAAiB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGA,QAAM,kBAAkB,CAAC,kBAAkB,cAAc,cAAc;AAGvE,OAAK,KAAK,EAAE,aAAa,EAAE,QAAQ,UAAQ;AACzC,QAAI,KAAK,MAAM,OAAO,SAAS,cAAc;AAC3C,YAAM,YAAY,KAAK,MAAM,OAAO;AAEpC,UAAI,eAAe,SAAS,SAAS,GAAG;AAEtC,cAAM,QAAQ,KAAK,MAAM,UAAU,KAAK,SAAO;AAC7C,cAAI,IAAI,SAAS,oBAAoB;AACnC,mBAAO,IAAI,YAAY;AAAA,cACrB,WACG,KAAK,SAAS,cAAc,KAAK,SAAS,qBAC3C,KAA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I,IAAI;AAAA,YAC7B;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAED,iBAAO,UAAU,CAAC,eAAe,IAAI,OAAO,MAAM,IAAI,GAAG;AACvD,qBAAS,OAAO;AAAA,UAClB;AAEA,cAAI,UAAU,OAAO,OAAO;AAE1B,gBAAI,aAAa,OAAO;AACxB,gBACE,WAAW,SAAS,8BACpB,WAAW,SAAS,4BACpB,OAAO,WACN,OAAO,OAAO,MAAM,SAAS,8BAC5B,OAAO,OAAO,MAAM,SAAS,2BAC/B;AACA,2BAAa,OAAO,OAAO;AAAA,YAC7B;AAEA,kBAAM,QAAQ,kBAAkB,YAAY,GAAG,eAAe;AAC9D,gBAAI,OAAO;AACT,sBAAQ,aAAa;AAAA,YACvB;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI,QAAQ,YAAY;AACtB,YAAQ,SAAS,KAAK,mBAAmB,SAAS,IAAI,wDAAwD;AAAA,EAChH;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/codemods/v1/not-implemented/mastra-required-id.ts"],"sourcesContent":["/* eslint-disable no-warning-comments */\nimport { insertCommentOnce } from '../../lib/add-comment';\nimport { createTransformer } from '../../lib/create-transformer';\n\n/**\n * Adds FIXME comments to Mastra primitives that now require an `id` parameter.\n * This includes storages, vector stores, agents, workflows, tools, scorers, and MCP servers.\n *\n * Before:\n * const agent = new Agent({ name: 'Support Agent' });\n * const tool = createTool({ description: 'Get weather' });\n *\n * After:\n * /* FIXME(mastra): Add a unique `id` parameter. See: ... *\\/\n * const agent = new Agent({ name: 'Support Agent' });\n * /* FIXME(mastra): Add a unique `id` parameter. See: ... *\\/\n * const tool = createTool({ description: 'Get weather' });\n */\nexport default createTransformer((fileInfo, api, options, context) => {\n const { j, root } = context;\n\n const COMMENT_MESSAGE =\n 'FIXME(mastra): Add a unique `id` parameter. See: https://mastra.ai/guides/v1/migrations/upgrade-to-v1/mastra#required-id-parameter-for-all-mastra-primitives';\n\n // List of class names that require id\n const storageClasses = [\n 'LibSQLStore',\n 'PostgresStore',\n 'D1Store',\n 'MongoDBStore',\n 'DynamoDBStore',\n 'LibSQLVector',\n 'PgVector',\n 'ChromaVector',\n 'PineconeVector',\n 'QdrantVector',\n 'LanceVector',\n 'Agent',\n 'MCPServer',\n ];\n\n // List of function names that require id\n const createFunctions = ['createWorkflow', 'createTool', 'createScorer'];\n\n // Find NewExpression for classes\n root.find(j.NewExpression).forEach(path => {\n if (path.value.callee.type === 'Identifier') {\n const className = path.value.callee.name;\n\n if (storageClasses.includes(className)) {\n // Check if the config already has an id property\n const hasId = path.value.arguments.some(arg => {\n if (arg.type === 'ObjectExpression') {\n return arg.properties?.some(\n prop =>\n (prop.type === 'Property' || prop.type === 'ObjectProperty') &&\n prop.key?.type === 'Identifier' &&\n prop.key.name === 'id',\n );\n }\n return false;\n });\n\n if (!hasId) {\n // Find the parent statement to add comment\n let parent = path.parent;\n const statementTypes = new Set([\n 'VariableDeclaration',\n 'ExpressionStatement',\n 'ReturnStatement',\n 'ExportDefaultDeclaration',\n 'ExportNamedDeclaration',\n 'Program',\n ]);\n\n while (parent && !statementTypes.has(parent.value.type)) {\n parent = parent.parent;\n }\n\n if (parent && parent.value) {\n // For export declarations, add comment to the export itself\n let targetNode = parent.value;\n if (\n targetNode.type !== 'ExportDefaultDeclaration' &&\n targetNode.type !== 'ExportNamedDeclaration' &&\n parent.parent &&\n (parent.parent.value.type === 'ExportDefaultDeclaration' ||\n parent.parent.value.type === 'ExportNamedDeclaration')\n ) {\n targetNode = parent.parent.value;\n }\n\n const added = insertCommentOnce(targetNode, j, COMMENT_MESSAGE);\n if (added) {\n context.hasChanges = true;\n }\n }\n }\n }\n }\n });\n\n // Find CallExpression for create functions\n root.find(j.CallExpression).forEach(path => {\n if (path.value.callee.type === 'Identifier') {\n const functionName = path.value.callee.name;\n\n if (createFunctions.includes(functionName)) {\n // Check if the config already has an id property\n const hasId = path.value.arguments.some(arg => {\n if (arg.type === 'ObjectExpression') {\n return arg.properties?.some(\n prop =>\n (prop.type === 'Property' || prop.type === 'ObjectProperty') &&\n prop.key?.type === 'Identifier' &&\n prop.key.name === 'id',\n );\n }\n return false;\n });\n\n if (!hasId) {\n // Find the parent statement to add comment\n let parent = path.parent;\n const statementTypes = new Set([\n 'VariableDeclaration',\n 'ExpressionStatement',\n 'ReturnStatement',\n 'ExportDefaultDeclaration',\n 'ExportNamedDeclaration',\n 'Program',\n ]);\n\n while (parent && !statementTypes.has(parent.value.type)) {\n parent = parent.parent;\n }\n\n if (parent && parent.value) {\n // For export declarations, add comment to the export itself\n let targetNode = parent.value;\n if (\n targetNode.type !== 'ExportDefaultDeclaration' &&\n targetNode.type !== 'ExportNamedDeclaration' &&\n parent.parent &&\n (parent.parent.value.type === 'ExportDefaultDeclaration' ||\n parent.parent.value.type === 'ExportNamedDeclaration')\n ) {\n targetNode = parent.parent.value;\n }\n\n const added = insertCommentOnce(targetNode, j, COMMENT_MESSAGE);\n if (added) {\n context.hasChanges = true;\n }\n }\n }\n }\n }\n });\n\n if (context.hasChanges) {\n context.messages.push(`Not Implemented ${fileInfo.path}: Mastra primitives now require a unique id parameter.`);\n }\n});\n"],"mappings":";;;;;;;;AAkBA,IAAO,6BAAQ,kBAAkB,CAAC,UAAU,KAAK,SAAS,YAAY;AACpE,QAAM,EAAE,GAAG,KAAK,IAAI;AAEpB,QAAM,kBACJ;AAGF,QAAM,iBAAiB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGA,QAAM,kBAAkB,CAAC,kBAAkB,cAAc,cAAc;AAGvE,OAAK,KAAK,EAAE,aAAa,EAAE,QAAQ,UAAQ;AACzC,QAAI,KAAK,MAAM,OAAO,SAAS,cAA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C,mBAAO,IAAI,YAAY;AAAA,cACrB,WACG,KAAK,SAAS,cAAc,KAAK,SAAS,qBAC3C,KAAK,KAAK,SAAS,gBACnB,KAAK,IAAI,SAAS;AAAA,YACtB;AAAA,UACF;AACA,iBAAO;AAAA,QACT,CAAC;AAED,YAAI,CAAC,OAAO;AAEV,cAAI,SAAS,KAAK;AAClB,gBAAM,iBAAiB,oBAAI,IAAI;AAAA,YAC7B;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAED,iBAAO,UAAU,CAAC,eAAe,IAAI,OAAO,MAAM,IAAI,GAAG;AACvD,qBAAS,OAAO;AAAA,UAClB;AAEA,cAAI,UAAU,OAAO,OAAO;AAE1B,gBAAI,aAAa,OAAO;AACxB,gBACE,WAAW,SAAS,8BACpB,WAAW,SAAS,4BACpB,OAAO,WACN,OAAO,OAAO,MAAM,SAAS,8BAC5B,OAAO,OAAO,MAAM,SAAS,2BAC/B;AACA,2BAAa,OAAO,OAAO;AAAA,YAC7B;AAEA,kBAAM,QAAQ,kBAAkB,YAAY,GAAG,eAAe;AAC9D,gBAAI,OAAO;AACT,sBAAQ,aAAa;AAAA,YACvB;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI,QAAQ,YAAY;AACtB,YAAQ,SAAS,KAAK,mBAAmB,SAAS,IAAI,wDAAwD;AAAA,EAChH;AACF,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mastra/codemod",
3
3
  "type": "module",
4
- "version": "0.0.0-refactor-agent-information-for-recomposable-ui-20251112151814",
4
+ "version": "0.0.0-trace-timeline-update-20251121114225",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Codemod CLI for Mastra",
7
7
  "bin": {
@@ -27,12 +27,14 @@
27
27
  "@commander-js/extra-typings": "^14.0.0",
28
28
  "@types/debug": "^4.1.12",
29
29
  "@types/jscodeshift": "^17.3.0",
30
- "@types/node": "^24.9.2",
30
+ "@types/node": "22.13.17",
31
+ "@vitest/coverage-v8": "4.0.12",
32
+ "@vitest/ui": "4.0.12",
31
33
  "eslint": "^9.37.0",
32
34
  "tsup": "^8.5.0",
33
35
  "typescript": "^5.8.3",
34
- "vitest": "^3.2.4",
35
- "@internal/lint": "0.0.0-refactor-agent-information-for-recomposable-ui-20251112151814"
36
+ "vitest": "4.0.12",
37
+ "@internal/lint": "0.0.0-trace-timeline-update-20251121114225"
36
38
  },
37
39
  "homepage": "https://mastra.ai",
38
40
  "repository": {