# uber/piranha

A tool for refactoring code related to feature flag APIs

Repository: https://github.com/uber/piranha
Canonical: https://ross.abutalabs.com/products/piranha
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: java, feature-flags, feature-toggles, refactoring-tools, objective-c, clang-plugin, stale-flags, ast, ast-matcher, deadcode, swift, swift-syntax, refactoring, code-quality, code-management, javascript
Last push: 2026-04-02T13:44:03+00:00

## Health v2 (maintenance only)
Score: 81/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 75, release rhythm 77, longevity 100
- inputs: {"age_days": 2827, "days_push": 153, "days_rel": 153, "gap_med": 3, "n_releases_24m": 16}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2472, forks 210 (observed 2026-08-28T04:06:54.753940+00:00)

## What it is
PolyglotPiranha is a lightweight code transformation toolset from Uber for automating large-scale code changes, primarily cleaning up stale feature flag code. It works via concrete-syntax/AST-based rewrite rules and is available as a Python library (polyglot-piranha) or a Rust CLI.

## Use cases
- remove stale feature flag code from a codebase
- automate large-scale code refactoring across many files
- replace feature toggle conditionals with constant values
- clean up dead code after flag cleanup
- write custom rewrite rules for Java, Swift, or JavaScript

## When to choose
- you need to delete or simplify code guarded by feature flags at scale
- you want rule-based, syntax-aware automated code edits in Java, Swift, Objective-C, or JavaScript
- you want a scriptable Python API plus CLI for code transformations

## When to avoid
- you need languages beyond those Uber supports (check forks for extras)
- you want a general-purpose IDE refactoring tool with interactive previews
- your transformations require full semantic analysis rather than syntax-level matching

## Facets
- artifact type: cli-tool
- maturity: active
- function: developer-tools, parser, workflow-automation
- domain: developer-tools, programming-languages
- platform: cli, python, rust
- tags: feature-flags, code-refactoring, stale-flag-cleanup, ast-transformation, static-analysis, polyglot, automation, linux, macos

## Member repositories
- uber/piranha (main) score 81

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:54.753940+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:28:33.337064+00:00, confidence not recorded.
  - readme: https://github.com/uber/piranha (fetched 2026-08-28T04:06:54.753940+00:00, sha 9214a87b0ddc)
- Data as of 2026-08-30T08:39:29.467469+00:00.
