Topos Structural Comparison
topos_compare_codeCompute the AST tree-edit distance between two code snippets for clone detection or refactoring impact measurement.
Instructions
Compute the AST (tree-edit) distance between two source-code strings.
Read-only and idempotent; parses both snippets in memory, never writes or
scores. Use for clone detection or to measure refactor impact; the
topos_assess_* tools already fold this in as an anti-gaming check, so
call it directly only for the raw number. Returns a ComparisonResult:
normalized_distance in [0, 1], similarity (= 1 - it),
raw_distance, an operations edit-count map, and
source_valid/target_valid (error set if either fails to parse).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes | Arguments for ``topos_compare_code``. |