Commit Graph

3 Commits

Author SHA1 Message Date
Sam Morrow ab759201c8 Fix package_clause naming and add declaration summaries for new/deleted files
Package clauses now extract the package name from the package_identifier
child node, showing 'package handler' instead of '_package_clause_0'.

New and deleted code files now show a declaration summary listing all
top-level symbols with their signatures, rather than just 'file added'
or 'file deleted'. This gives the model a table-of-contents view of
what was added/removed.
2026-02-10 00:20:16 +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
Sam Morrow 1777da6eba Add feature-flagged compare_file_contents tool with semantic diffs
Add a new compare_file_contents MCP tool that compares two versions of a
file across refs (branches, tags, or SHAs). For structured data formats
(JSON, YAML, CSV, TOML), it produces semantic diffs that show only
meaningful changes, ignoring formatting differences. For unsupported
formats, it falls back to unified diff.

Key features:
- Semantic diffs for JSON, YAML, CSV, TOML files
- Unified diff fallback for code and other text files
- Handles new files (base not found) and deleted files (head not found)
- 1MB max file size to prevent excessive server-side processing
- Gated behind 'compare_file_contents' feature flag

This helps AI models by:
- Reducing token usage (formatting noise eliminated)
- Providing unambiguous before/after semantics
- Enabling self-verification of edits to config/data files

Refs: #1973
2026-02-09 22:50:59 +01:00