Expand description
Add-parameter recipe: insert a new parameter into a function signature and update all call sites.
Algorithm:
- Parse
filewith tree-sitter; locate the function declaration namedfunction_name. - Find the parameter list node; determine insertion byte position.
- Build the parameter text for the definition (name + optional type annotation).
- Find all call sites via the facts index (
find_callers). Falls back to text search if the index is unavailable, with a warning. - At each call site: find the argument list; insert
default_valueatposition. - Return a
RefactoringPlanwith onePlannedEditper affected file.
Language support: Rust, TypeScript/JavaScript, Python. Node kinds by language:
- Rust:
function_item→parameters, args inarguments - Python:
function_definition→parameters, args inargument_list - JS/TS:
function_declaration/function/method_definition/arrow_function→formal_parameters, args inarguments
Structs§
- AddParameter
Outcome - Outcome of a successful add-parameter plan.
Functions§
- plan_
add_ parameter - Build an add-parameter plan without touching the filesystem.