Repository navigation
Releases: pfichtner/java-refactoring-mcp
Release list
v0.1.3
Release v0.1.3
New Features
Locator: position + name cross-validation
A locator can now accept both a character offset / line number and a name at the same time. When both are supplied, the resolved AST node is validated against the name — a clear error is raised if they disagree instead of silently acting on the wrong target.
# CLI — both flags accepted, cross-validated
--line 42 --name updateQuality
MCP: apply-by-default with dryrun preview
All MCP tools now apply changes to disk by default. Pass "dryrun": true to preview the diff without writing, then call again without it to apply. This matches the IDE model and removes the extra opt-in round-trip.
Bug Fixes
- MCP
list_refactorings— the tool list is now rendered directly from the live tool registry, so it is always in sync with the tools actually installed.
v0.1.2
What's new
change_method_signature — change parameter types (param_types)
The signature refactoring now accepts a param_types option to substitute
parameter types without removing or adding parameters:
param_typesalone applies type changes to the declaration only
(e.g.int→long).- Combined with
paramOrder, the type substitutions are woven into the
reordered parameter text, so both axes compose. - Overloaded-target disambiguation also landed: identical tool descriptions
across operations were tightened, andremove_paramnow cross-references
change_method_signaturefor the "change type without removal" case.
CLI: --param-types option added to ChangeMethodSignatureCommand.
widen_visibility option for pull-up and move refactorings
Five refactorings that move members across class/package boundaries gain a
boolean widen_visibility option (default true):
pull_up_field/pull_up_method:private→protectedin the superclassmove_method:private→ package-private (same package) orpublic(cross-package)move_static_member: same minimum-required visibility logicmove_class: package-private class →publicwhen crossing packages
Existing call signatures are unchanged (they delegate with true). Ten new
approval tests cover the true/false pair per refactoring.
Full Changelog: v0.1.1...v0.1.2
v0.1.1
New Features
- remove_method — Remove a method from a class or interface. By default (cascade=true) also removes every overriding method in subclasses and every implementing method in implementing classes. Returns a map of changed files.
project_root=<absolute project root>
file=<absolute path to source file>
method=<method name> # name-based locator
cascade=false # optional, default true
Breaking Changes
- move_method and move_static_member now require fully-qualified target class names. Pass gildedrose.AgedBrieUpdater instead of AgedBrieUpdater. Bare simple names are rejected.
Bug Fixes
- rename_package — changed files are now returned sorted by path, giving deterministic output regardless of filesystem ordering.
Demo
- The Gilded Rose chain-of-responsibility demo (gilded-rose-demo/) has been updated to showcase remove_method in the CONTRACT phase: after introducing the chain dispatch, the four dead delegation stubs are removed one by one via remove_method, leaving a clean final GildedRose.java. Both asciinema recordings have been re-recorded.