惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
M
MIT News - Artificial intelligence
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
博客园_首页
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
F
Fortinet All Blogs
腾讯CDC
罗磊的独立博客
IT之家
IT之家
I
InfoQ
V
V2EX
博客园 - 叶小钗
A
About on SuperTechFans
Y
Y Combinator Blog
C
Check Point Blog
量子位
Martin Fowler
Martin Fowler
Vercel News
Vercel News

The Rust Programming Language Forum - Latest topics

Beginner building a Rust backend framework (AI-assisted) — feedback appreciated C++ to Rust -- Exceptions Re-exporting a trait with a custom derive_macro Gold linker is deprecated Why is using PhantomData valid in this case? Code review for Static Pool Allocator Looking for a pool based allocator Why is this legal? What does it mean for Rustc to run "out of TLS keys"? Using async/await internally with no internal runtime, but exposing a nonblocking poll API — is this a reasonable design? Testing functions that use randomness `cargo-path`: improve coding agents&#39; ability to find Rust documentation Rust task runners Lifetime weird case Windows - USB device not detected A random rustc-ice-[...].txt file appeared Develop rust where the environment is setup in a docker Undefined Behavior: in-bounds pointer arithmetic failed: attempting to offset pointer by 20 bytes, but got alloc238 which is only 1 byte from the end of the allocation Unbug 0.5 - Runtime debug assertions Is there a tiny error in section 6.2 Reference types? Lifetime woes implementing ratatui::Widget for a reference Rusqlite + Chrono: How do I simplify code to obtain chrono datetime value From OOP to Rust – struggling with code organization and data structure design Way to avoid a self-referential struct Rust RF and audio resources/communities Whyhttp - HTTP mocks that fail where the bug actually is Using tokio channel permits in a tower service Arc::increment_strong_count design question (cross-post) `&T`, `&mut T`, `Pin<&mut T>` and `&Cell<T>`: Ways of Borrowing a `T` Ratatui detect arrow key press and release
Sem: semantic entity level version control CLI built with...
rs545837 · 2026-04-20 · via The Rust Programming Language Forum - Latest topics

I've been researching and working on a CLI tool called sem that diffs code at the entity level (functions, classes, structs) instead of raw lines. Written in Rust, open source.

The motivation came from feeding diffs to LLMs. Line-level diffs are optimized for human eyes scanning a terminal, but when you feed a git diff to a model, most of those tokens are context lines, hunk headers, and unchanged code. I ran some attention score experiments and found the model concentrates significantly better on semantic diffs than raw git diffs.

sem uses tree-sitter to extract entities and diffs at that level. Instead of lines with +/- noise, you get exact entity changes: which struct changed, which function was added, which ones were modified. It also builds a cross-file dependency graph with petgraph and does transitive impact analysis via BFS.

Commands:

  • sem diff - entity-level diff with word-level inline highlights
  • sem entities - list all entities in a file with their line ranges
  • sem impact - show what breaks if an entity changes
  • sem blame - git blame at the entity level
  • sem log - track how an entity evolved over time
  • sem context - token-budgeted context for LLMs

Parsers for Rust, Python, TypeScript, Go, Java, C, C++, C#, Ruby, Bash, Swift, Kotlin, plus JSON, YAML, TOML, Markdown, CSV.

There's also an extension of this research study towards a git merge driver called Weave that plugs into git via .gitattributes and resolves conflicts at the entity level. Two developers editing different methods in the same class get a clean merge instead of a conflict.

I wrote up the algorithmic decisions (structural hashing with xxHash64, three-phase entity matching, BFS vs DFS for impact analysis, Rayon for parallel parsing) here: Building Semantic Version Control in Rust

Install: brew install sem-cli

GitHub: https://github.com/Ataraxy-Labs/sem

Happy to answer any questions about the tree-sitter integration or the graph approach. Always eager for constructive criticism.