// HACKER NEWS — CYBERSECURITY
Show HN: Treepeat – Code similarity detection using Tree-sitter
treepeat is a tool that finds similarities in your codebase.
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. PRs welcome!
Languages supported: astro, bash, css, go, html, javascript, lua, markdown, python, sql, typescript, java, kotlin, rust, yaml
Scan a codebase for similar or duplicate code blocks using tree-sitter AST analysis and locality-sensitive hashing.
--progress is intended primarily as interactive CLI feedback. The current implementation writes tqdm progress bars to stderr, leaving normal command output on stdout or --output.
List all rules in a ruleset, along with their descriptions. Use --language to see which rules apply to a specific language.
Display how treepeat normalizes source code into tree-sitter tokens for similarity detection -- helpful for debugging why a certain section of a file might be similar to another. Shows the original source code side-by-side with the normalized token representation.
Performance harness for benchmarking real repositories: tools/perf/harness.py (docs).