Commit Graph

3 Commits

Author SHA1 Message Date
Sam Morrow d8ed060413 Extract names from var/const declarations in Go
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
var_declaration and const_declaration nodes contain spec children
(var_spec, const_spec) with name fields. The Go name extractor now
handles these the same way as type_declaration, so nested diffs show
'var_declaration storeLine' instead of '_var_declaration_25'.
2026-02-09 23:45:55 +01:00
Sam Morrow 4b0cd4c6ac Add inline diffs and recursive nesting for structural diff
Modified declarations now show what changed inside them:
- Inline line-level diffs using LCS for precise change detection
- Whitespace-normalized comparison for brace languages (Go, JS, etc.)
  so indentation-only changes collapse to '(whitespace/formatting only)'
- Exact comparison for whitespace-significant languages (Python)
- Recursive nesting into classes/modules to pinpoint which method changed
  e.g. 'class Dog: modified > method bark: modified > line change'
- Max depth of 5 prevents unbounded recursion
- Added method_definition to JS/TS/TSX declaration kinds for class methods
2026-02-09 23:43:27 +01:00
Sam Morrow d608c4b99b Add tree-sitter structural diff for code files
Extends the compare_file_contents tool with AST-based structural
diffing for code files using tree-sitter. Instead of line-based diffs,
this shows declaration-level changes (functions, classes, types) which
gives models more concise and semantically meaningful context.

Supported languages: Go, Python, JavaScript, TypeScript, Ruby, Rust,
Java, C/C++.

Requires CGO_ENABLED=1 for the tree-sitter C bindings. Windows builds
are removed from goreleaser as CGO cross-compilation is not supported
without additional toolchain setup.

For unsupported languages, falls back to unified line-based diff.
2026-02-09 23:20:55 +01:00