Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

PolyglotPiranha

github.com

  • Free plan
  • macOS
  • Linux
  • iPhone and iPad
  • API
  • Self-hosted
7.5 Club score Visit github.com

What PolyglotPiranha is

PolyglotPiranha is a free structural search-and-replace engine for multilingual code cleanup. It can target stale feature-flag code when given a flag name, expected behavior, and rules for the relevant feature-flag API. Cleanup rules can be linked in graphs, with built-in language-specific operations such as simplifying boolean expressions and if-else statements, removing empty declarations or files, and inlining local variables. Queries and filters support Tree-sitter queries, regular expressions, or Piranha’s concrete syntax. The project provides a Python library and command-line tool, with the Python API wrapping the CLI. The CLI lists Java, Swift, Python, Kotlin, Go, TSX, and TypeScript. Dry runs prevent in-place rewriting, while summaries report matches, rewrites, and resulting file content after analysis or rewriting. Configuration requires code and configuration paths, a target language, and substitutions, and may include rules.toml and edges.toml. The Python API installs with pip; the CLI can be built with Rust and Cargo or obtained from repository releases. It is Apache 2.0 licensed, provided as is, and not an official Uber product.

Who it suits

PolyglotPiranha suits developers and teams automating structural refactoring across supported languages. Its Python wrapper can be incorporated into pipelines, while the CLI supports project-level batch cleanup.

Good to know, and what to watch

  • Supports seven listed target languages
  • Python library and CLI interfaces
  • Dry-run mode avoids in-place edits
  • Composable graph-based rules
  • Apache 2.0 license
  • No prebuilt rule for every cleanup
  • Repository says new languages are unlikely
  • Provided as is
  • Questions handled through GitHub issues

The verdict

PolyglotPiranha provides configurable, AST-oriented cleanup for feature flags and other structural refactoring. Its language list, custom-rule requirement, and as-is project status should guide adoption decisions.

What the maker publishes

Cleanup
Prebuilt language-specific rules can simplify boolean expressions and if-else statements, remove empty declarations, delete empty files, and inline local variables. source
Configuration
The API requires a code path, configuration path, target language, and substitutions; configuration can include rules.toml and edges.toml files. source
Custom cleanup limit
Piranha does not include prebuilt rules for every cleanup, such as adding a custom import, so users can write a cleanup rule for that task. source
Dry run
The dry-run option disables in-place rewriting, and the output summary includes matches, rewrites, and file content after rewriting or analysis. source
Feature flag cleanup
It can refactor code related to stale feature flags using a flag name, expected behavior, and configured feature flag API rules. source
Installation
The Python API is installed with pip, while the CLI can be built from source with Rust and Cargo or obtained from the repository’s releases. source
Integrations
The Python wrapper is described as suitable for incorporation into pipelines; the documentation does not name specific CI or feature flag vendor integrations. source
Interfaces
The project can be used as a Python library or as a command-line tool, and its Python API wraps the CLI. source
Languages
The CLI lists Java, Swift, Python, Kotlin, Go, TSX, and TypeScript as target languages. source
Language support limit
The repository says it supports languages used at Uber and likely will not add new languages there. source
License
Piranha is licensed under Apache 2.0. source
License and status
Piranha is licensed under Apache 2.0, and the repository states it is not an official Uber product and is provided as is. source
Other refactoring
Users can also use custom rule chains for structural search and replace beyond stale feature flags. source
Purpose
Polyglot Piranha is a multilingual structural search and replace engine that applies chains of interdependent rules for code cleanup. source
Purpose
Polyglot Piranha is a lightweight code transformation toolset for automating large scale changes and is used at Uber mostly to clean up stale feature flags. source
Rule engine
Rules can be composed into graphs, and the engine provides prebuilt language-specific cleanup rules such as simplifying boolean expressions and removing empty declarations. source
Rule formats
Queries and filters can use Tree-sitter queries, regular expressions, or Piranha’s concrete syntax. source
Security
The repository identifies the project as provided as-is and does not state security certifications or compliance claims. source
Support
Users with questions or bug reports are directed to open a GitHub issue. source
Supported languages
The CLI lists Java, Swift, Python, Kotlin, Go, TSX, and TypeScript as target languages. source

Checked against the maker's pages on 7 Oct 2026.