Skip to content

trace tool: CLI integration and legacy method deprecation #241

@HumanBean17

Description

@HumanBean17

Summary

Once the trace MCP tool is proven in production, reuse its engine to add a java-codebase-rag trace CLI command and deprecate the legacy find_callers/find_callees methods in kuzu_queries.py.

Background

find_callers and find_callees in kuzu_queries.py already implement multi-hop BFS with depth, confidence filtering, and module/microservice scoping. They serve the CLI (java-codebase-rag commands), not the MCP surface. The new trace engine (from PR #234) is strictly more capable: it adds role-based pruning, fan-out throttling, trivial chain collapsing, cross-service seamless traversal, and structured path output.

Plan

Phase 1: Add trace CLI command

Add a java-codebase-rag trace subcommand that reuses the mcp_trace.py engine:

java-codebase-rag trace --from <fqn-or-id> --direction out --edge-types CALLS --max-depth 3

Output: text/JSON rendering of TraceOutput (same structure as MCP tool result).

This gives CLI users the same pruning and path-structuring benefits that MCP users get.

Phase 2: Deprecate find_callers/find_callees

  • Mark KuzuGraph.find_callers and KuzuGraph.find_callees as deprecated with a warnings.warn(DeprecationWarning).
  • Update any CLI subcommands that use them to use the new trace engine instead.
  • Update docs/JAVA-CODEBASE-RAG-CLI.md to recommend trace over the legacy commands.

Phase 3: Remove legacy methods

  • Remove find_callers and find_callees from kuzu_queries.py.
  • Remove the CallEdge dataclass if no longer needed.
  • Clean up any tests that test only the legacy path.

Acceptance criteria

  • java-codebase-rag trace command works with all pruning parameters
  • Existing CLI functionality that relied on find_callers/find_callees is preserved via the trace engine
  • find_callers/find_callees emit DeprecationWarning before removal
  • Tests pass with the new engine for CLI use cases

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    trace toolFollow-ups and future development for the trace MCP tool

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions