Stellarion
Tools

stellarion_compare_symbols [Pro]

Deep comparison of two functions with structural diff and shared dependencies
This is a Pro tool. Requires a Stellarion Pro license. A 180-day free trial starts automatically.

Performs a deep comparison of two functions: computes a similarity score, produces a structural diff, and identifies shared callers and callees. Identify each function by node ID or by file path and line number.

When to Use

  • After stellarion_find_duplicates or stellarion_find_similar flags a pair — drill into the details
  • When deciding whether two similar functions can be merged into one
  • To understand how two implementations of the same concept differ
  • During code review when a reviewer suspects duplicated logic

Parameters

ParameterTypeRequiredDefaultDescription
uriAstringNoFile path of the first function (used with lineA)
lineAnumberNoLine number of the first function (used with uriA)
uriBstringNoFile path of the second function (used with lineB)
lineBnumberNoLine number of the second function (used with uriB)
nodeIdAstringNoGraph node ID of the first function (alternative to uriA + lineA)
nodeIdBstringNoGraph node ID of the second function (alternative to uriB + lineB)

Provide either nodeIdA/nodeIdB or uriA+lineA/uriB+lineB for each function.

Examples

Compare two functions by location

Compare the function at src/auth/validate.ts line 15 with the one at src/api/check_auth.ts line 42.

Returns a detailed comparison including similarity score, structural differences, and shared dependencies.

Compare by node IDs

Compare nodes abc123 and def456 — are they duplicates?

Uses node IDs from a previous query (e.g., from stellarion_find_duplicates).

Merge feasibility check

I found two similar functions: processPayment in payment.rs line 30 and handlePayment in checkout.rs line 55.
Can they be merged? Compare them in detail.

The structural diff and shared callers/callees help determine merge feasibility.

Output Format

  • Similarity score — 0.0 to 1.0 overall semantic similarity
  • Structural diff — differences in control flow, parameter count, return types, and logic structure
  • Shared callers — functions that call both A and B (these would need updating if you merge)
  • Shared callees — functions that both A and B call (shared dependencies)
  • Unique callers/callees — dependencies specific to each function

Tips

  • A high similarity score (> 0.85) with few structural differences makes merging straightforward
  • If both functions share callers, merging them simplifies the calling code
  • If they have different callers but identical logic, consider extracting the shared logic into a helper
  • Structural diffs are more informative than text diffs — they show differences in control flow rather than formatting
  • Works cross-language: you can compare a TypeScript function with a Python function