Menu

I taught Knip where Mastra keeps its files
📰

I taught Knip where Mastra keeps its files

DEV Community: javascript·Ashok Ram·4 days ago
#j8dFGwru
#devtojavascript#devto#dev#mastra#knip
Long article (536 words) — no AI summary yet.
Reading 0:00
15s threshold

Your app uses a file every time it starts, and your cleanup tool says you can delete it. That was life for anyone running Knip on a Mastra project.

I wrote the Mastra plugin for Knip in webpro-nl/knip#2227 , after joealden asked for one in issue #2222 . The fix came from reading the framework's own code.

Quick intro to both tools

Knip looks for leftovers in JavaScript and TypeScript projects: files, packages and exports nothing uses anymore. It starts at your entry files and follows every import . Anything left unvisited lands in the report.

Mastra helps you build agents and workflows in TypeScript. Its commands mastra dev and mastra build scan the src/mastra folder and load files by where they sit: index.ts , anything in workflows/ and tools/ , and agent folders under agents/ with their config, memory, tools, schedules and nested subagents.

Why Knip got it wrong

It's like a party where Knip only counts guests who arrived with someone already inside. Mastra's files skip that.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.