Supported Languages¶
kedge uses tree-sitter for AST-based fingerprinting. Supported languages get whitespace/comment-immune, symbol-scoped fingerprints. All other file types fall back to SHA-256 content hashing.
AST fingerprinting¶
| Language | Extensions | Symbol syntax | Example |
|---|---|---|---|
| Java | .java |
ClassName#methodName |
AuthService#validateToken |
| Go | .go |
FunctionName |
HandleRequest |
| TypeScript | .ts, .tsx, .js, .jsx |
ClassName#methodName or functionName |
UserService#create |
| Python | .py |
ClassName#method_name or function_name |
AuthService#validate_token |
| Rust | .rs |
StructName#method_name or function_name |
TokenStore#get |
| XML | .xml |
(file-level only) | -- |
How AST fingerprinting works¶
- kedge parses the source file using the language's tree-sitter grammar
- If a
symbolis specified, kedge navigates to that symbol's AST subtree - It walks the AST, hashing each node's kind and leaf token text
- Comment nodes (
line_comment,block_comment,comment,multiline_comment) are skipped - The hash is truncated to 16 hex characters:
sig:a1b2c3d4e5f67890
Properties¶
- Whitespace immune: reformatting, indentation changes, and blank line additions don't change the fingerprint
- Comment immune: adding, removing, or editing comments doesn't change the fingerprint
- Rebase/squash safe: the fingerprint is computed from code structure, not git history
- Symbol-scoped: when tracking a specific method, changes to other methods in the same file don't trigger drift
Symbol resolution¶
ClassName#methodName (Java, TypeScript, Python, Rust)¶
kedge finds the class/struct declaration matching ClassName, then searches its body for a method matching methodName.
- Java: matches
class_declarationandmethod_declaration/constructor_declarationnodes - TypeScript/TSX: matches
class_declaration/classandmethod_definition/function_declarationnodes - Python: matches
class_definitionandfunction_definitionnodes; handlesdecorated_definitionwrappers (decorators are included in the fingerprint) - Rust: matches
impl_itemblocks by type name andfunction_itemnodes within
functionName (Go, TypeScript, Python, Rust)¶
kedge searches for a top-level function declaration matching the name. No class scoping.
- Go: matches
function_declarationandmethod_declarationnodes - TypeScript: matches
function_declarationnodes - Python: matches
function_definitionnodes - Rust: matches
function_itemnodes
XML¶
XML files are always fingerprinted at file level. Symbol scoping is not supported.
Content-hash fallback¶
Files with extensions not matching any supported language (or when AST parsing fails) fall back to SHA-256 content hashing:
- Hash the raw file content with SHA-256
- Truncate to 16 hex characters:
sig:a1b2c3d4e5f67890
The fallback hashes raw content, so whitespace and comment changes register as drift. Without AST understanding, kedge cannot distinguish structural changes from cosmetic ones.
Adding language support¶
kedge's language support is extensible. See Adding a Language for a step-by-step guide to adding a new tree-sitter grammar.