Show HN: Treepeat – Code similarity detection using Tree-sitter
44 points by 91awebsi 3 days ago | 3 comments
treepeat is a tool that finds similarities in your codebase.
Find duplicate code blocks meaningful to the language (classes/functions), not just lines.
Find near-duplicates: ignore whitespace, strings, high level AST nodes such as function and names.
Find structurally similar code: anonymize identifiers, constants, etc.
Pull requests welcome: This is very much an proof of concept - I'm happy with it, but I haven't supported very many languages at present.
Languages supported: astro, bash, css, go, html, javascript, lua, markdown (plus codeblocks), python, sql, typescript, java, kotlin, rust, yaml
Game_Ender 14 minutes ago
Thank you for a README that is readable. It might have a bit of AI help but it’s concise and makes it clear how to use the tool.
replyryuuseijin 2 hours ago
This is what I wanted to help with duplicate code detection, which is now a real problem with agentic programming since the agent tends to duplicate helper functions a lot in bigger codebases.
replyI ended up writing my own tool [1] that uses vector search, which works but can be unusably slow in large codebases.
I will give this a shot.