_rebuild_code() in the open-source Graphify-Labs/graphify repository.
What you’ll build
- A list of every direct caller of the function you plan to change.
- The call path between two parts of the code.
- A short list of tests to run, taken from the graph.
- A rebuilt graph after the change, to confirm the impact.
Setup
Step 1: Check how central the target is
Step 2: List what the change affects
affected walks edges backwards: calls, imports, inheritance and similar relations. --depth 1 gives direct callers. Raise it to see callers of callers. The test functions in the list are the tests to run first.
Step 3: Trace how two modules connect
path when you want to know whether a change in one area can reach another. If no directed path exists, add --undirected to find any connection.
Step 4: See the community around it
Step 5: Make the change, then rebuild
update re-extracts changed code without an API cost. Compare the new list with the one from Step 2. A caller that vanished or appeared is worth a second look in review.
When it goes wrong
path exits with code 3 and prints candidates. The name matched more than one node. Copy one of the path::symbol candidates it prints.
affected prints “No unique node match” and exits 0. The label didn’t match. Check the exact label with graphify explain or graphify query. Because the exit code is 0, a script won’t fail on it, so check the output.
A caller you know about is missing. Impact results list direct connections the parser can see. Code called dynamically, through reflection, or by string name may not appear. Always run your test suite.
Production patterns
- Paste the
affectedoutput into the pull request description so reviewers see the planned blast radius. - Run the impact check in CI with Graph impact comment on every PR.
- In Graphify, the hosted product, ask your agent “what breaks if I change
_rebuild_code?”. The hosted MCP answers with thegraphify_impactandgraphify_tests_fortools.
Complete example
What you built
You have a refactor plan backed by the graph: the callers, the paths between modules, the tests to run, and a before-and-after check.Next steps
Check impact
How Graphify works out what a change reaches.
Review PRs as a team
Check the finished refactor against the same graph.
Try it in Graphify
We build and host the graph for you. Start with a 14-day Pro trial, then keep up to 3 repositories on Free. No card required.