Skip to content

feat: add v2 codemod draft - #1950

Merged
felixweinberger merged 49 commits into
mainfrom
feature/v2-codemode-draft
May 21, 2026
Merged

felixweinberger merged 49 commits into
mainfrom
feature/v2-codemode-draft

claude review fixes

44ac609
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Apr 23, 2026 in 7m 42s

Code review found 2 important issues

Found 5 candidates, confirmed 4. See review comments for details.

Details

Severity Count
🔴 Important 2
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important packages/codemod/src/cli.ts:23-39 CLI --list flag unreachable: is a required positional
🔴 Important packages/codemod/src/cli.ts:84-102 CLI diagnostic output: warnings force exit 1 and info diagnostics are dropped
🟡 Nit packages/codemod/src/utils/projectAnalyzer.ts:6-28 analyzeProject never finds package.json for the documented ./src usage

Annotations

Check failure on line 39 in packages/codemod/src/cli.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

CLI --list flag unreachable: <target-dir> is a required positional

The PR description documents `npx mcp-codemod v1-to-v2 --list` as the way to list transforms, but the command is declared as `.command(`${name} <target-dir>`)` — commander treats `<target-dir>` as a required positional and exits with "missing required argument 'target-dir'" before the action callback runs, so the `opts['list']` early-return is unreachable. Change the positional to optional (`[target-dir]`) and validate it inside the action when `--list` is not set.

Check failure on line 102 in packages/codemod/src/cli.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

CLI diagnostic output: warnings force exit 1 and info diagnostics are dropped

Two issues in the diagnostic-printing block: (1) the warnings branch sets `process.exitCode = 1`, but advisory warnings ("Verify the migration is correct") are emitted on virtually every successful run — e.g., the ErrorCode split, RequestHandlerExtra rename, and removed-import paths all push `warning(...)` — so the documented happy-path `npx mcp-codemod v1-to-v2 ./src` prints "Migration complete." and then exits non-zero, breaking `set -e` scripts and CI. Only `DiagnosticLevel.Error` should fail

Check warning on line 28 in packages/codemod/src/utils/projectAnalyzer.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

analyzeProject never finds package.json for the documented ./src usage

`analyzeProject` only checks `path.join(targetDir, 'package.json')` with no upward walk, but every CLI example in the PR description uses `./src` as the target — where `package.json` virtually never exists — so `projectType` is always `'unknown'` and the documented "project-level package.json" tier of context resolution is unreachable in practice. Consider walking up from `targetDir` to the nearest `package.json` (and note that even when found, it checks for v2 package names that a v1 project be