Structural diff
structural_diff
Structural branch diff — symbol-level comparison between git refs.
Uses git worktrees to checkout both refs and analyze_package() on
each version, then compares symbol sets by name + signature.
Example
from axm_ast.core.structural_diff import structural_diff result = structural_diff(Path("src/mylib"), "main", "feature") result["added"][{"name": "new_func", "kind": "function", "file": "core.py", ...}]
structural_diff(pkg_path, base, head)
Compare two git refs at symbol level.
Uses git worktrees to checkout the base ref, runs
analyze_package() on both versions, and diffs the
symbol sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg_path
|
Path
|
Path to the package directory. |
required |
base
|
str
|
Base git ref (branch, tag, or commit). |
required |
head
|
str
|
Head git ref (branch, tag, or commit). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with |
dict[str, Any]
|
|
dict[str, Any]
|
|
Example
result = structural_diff(Path("src/mylib"), "main", "feature") len(result["added"]) 3