Freedom251 › Code Refactoring Tools
PolyglotPiranha

What PolyglotPiranha is
PolyglotPiranha is a free multilingual structural search and replace engine for code cleanup. It can remove code associated with stale feature flags when given a flag name, expected behavior, and rules for the relevant feature flag API. Cleanup rules can be connected into graphs, and the project includes language-specific rules for tasks such as simplifying boolean expressions and if-else statements, removing empty declarations and files, and inlining local variables. Queries and filters can use Tree-sitter queries, regular expressions, or Piranha’s concrete syntax. Custom rule chains can also perform structural search and replace beyond feature flag cleanup.
The project is available as a Python library and a command-line tool; the Python API wraps the CLI. The CLI lists Java, Swift, Python, Kotlin, Go, TSX, and TypeScript as target languages. A dry-run option prevents in-place edits, and the output summary includes matches, rewrites, and file content after rewriting or analysis. API configuration requires a code path, configuration path, target language, and substitutions, and may include rules.toml and edges.toml files. The Python API is installed with pip; the CLI can be built from source with Rust and Cargo or obtained from repository releases. Piranha is licensed under Apache 2.0, is provided as is, and is not an official Uber product.
Who it suits
It suits developers who need repeatable code cleanup across projects, especially removal of stale feature flag code or other structural refactoring expressed as rule chains. Teams can use its Python wrapper in pipelines, or run the command-line tool against supported target languages.
What it does well
- Includes cleanup rules for seven listed target languages.
- Can chain interdependent rules into graphs.
- Dry runs prevent in-place rewriting.
- Available as a Python library and command-line tool.
- Licensed under Apache 2.0.
What to know first
- Some cleanups require users to write their own rules.
- The repository says it likely will not add languages beyond those used at Uber.
- The project is provided as is.
Limits
The free project does not include prebuilt rules for every cleanup; for example, adding a custom import may require a rule you write. Its repository says it supports languages used at Uber and likely will not add new languages there.
Getting started
- Open the project repository on GitHub.
- Install the Python API with pip, or obtain the CLI from repository releases.
- Alternatively, build the CLI from source using Rust and Cargo.
- For API use, provide a code path, configuration path, target language, and substitutions.
- Configure rules and edges as needed, then use dry run to analyze without in-place rewriting.
Verdict
Choose PolyglotPiranha if you need rule-driven structural cleanup, particularly for stale feature flags, and can configure or write the rules your code requires. Look elsewhere if you need prebuilt support for a cleanup the project does not cover or support for additional languages.
Questions
Is PolyglotPiranha free?
Yes. Its pricing model is free, with a free plan and no free trial.
Which languages does the CLI target?
The CLI lists Java, Swift, Python, Kotlin, Go, TSX, and TypeScript.
How can I install it?
Install the Python API with pip. The CLI is available through repository releases or can be built from source with Rust and Cargo.
Is it open source, and what license does it use?
It is licensed under Apache 2.0.
Can it run as part of a pipeline?
The Python wrapper is described as suitable for incorporation into pipelines. The documentation does not name specific CI or feature flag vendor integrations.
Who makes PolyglotPiranha?
The repository says it is not an official Uber product and is provided as is.
Facts from PolyglotPiranha's own pages
- Cleanup
- Prebuilt language-specific rules can simplify boolean expressions and if-else statements, remove empty declarations, delete empty files, and inline local variables. · github.com, 7 Oct 2026
- Configuration
- The API requires a code path, configuration path, target language, and substitutions; configuration can include rules.toml and edges.toml files. · github.com, 7 Oct 2026
- 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. · github.com, 7 Oct 2026
- Dry run
- The dry-run option disables in-place rewriting, and the output summary includes matches, rewrites, and file content after rewriting or analysis. · github.com, 7 Oct 2026
- Feature flag cleanup
- It can refactor code related to stale feature flags using a flag name, expected behavior, and configured feature flag API rules. · github.com, 7 Oct 2026
- 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. · github.com, 7 Oct 2026
- Integrations
- The Python wrapper is described as suitable for incorporation into pipelines; the documentation does not name specific CI or feature flag vendor integrations. · github.com, 7 Oct 2026
- Interfaces
- The project can be used as a Python library or as a command-line tool, and its Python API wraps the CLI. · github.com, 7 Oct 2026
- Languages
- The CLI lists Java, Swift, Python, Kotlin, Go, TSX, and TypeScript as target languages. · github.com, 7 Oct 2026
- Language support limit
- The repository says it supports languages used at Uber and likely will not add new languages there. · github.com, 7 Oct 2026
- License
- Piranha is licensed under Apache 2.0. · github.com, 7 Oct 2026
- 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. · github.com, 7 Oct 2026
- Other refactoring
- Users can also use custom rule chains for structural search and replace beyond stale feature flags. · github.com, 7 Oct 2026
- Purpose
- Polyglot Piranha is a multilingual structural search and replace engine that applies chains of interdependent rules for code cleanup. · github.com, 7 Oct 2026
- 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. · github.com, 7 Oct 2026
- Rule formats
- Queries and filters can use Tree-sitter queries, regular expressions, or Piranha’s concrete syntax. · github.com, 7 Oct 2026
- Security
- The repository identifies the project as provided as-is and does not state security certifications or compliance claims. · github.com, 7 Oct 2026
- Support
- Users with questions or bug reports are directed to open a GitHub issue. · github.com, 7 Oct 2026
- Supported languages
- The CLI lists Java, Swift, Python, Kotlin, Go, TSX, and TypeScript as target languages. · github.com, 7 Oct 2026
Where PolyglotPiranha stands on Freedom251
- Code Refactoring Tools#13 of 22