fix(codemod): only count real module specifiers in project-type inference (#2765)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
claude[bot] 2026-09-09 23:50:57 +03:00 • committed by GitHub
commit 5ecc791d81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,5 @@
---
'@modelcontextprotocol/codemod': patch
---
Project-type inference no longer counts bare SDK paths that appear only in ordinary string data. The v1→v2 codemod's source scanner matched any quoted `@modelcontextprotocol/sdk/client|server` subpath anywhere in a file, so a server path stored as data (example text, a log message, a config value) misclassified a client-only project as `both` — rewriting shared type imports to `@modelcontextprotocol/server` and adding a server dependency the project never uses. The scanner now requires a module-specifier position: static imports and re-exports (`from '...'`), side-effect imports, dynamic `import('...')` (including webpack magic comments), `require('...')` / `require.resolve('...')`, and the `vi.`/`jest.` mock-method calls the mock-paths transform rewrites. Known limitation: the scan is lexical, so a string whose text embeds a complete import statement still counts.