Use flag-prune to remove stale Unleash, LaunchDarkly, PostHog, Statsig, and
OpenFeature feature flags from JavaScript, TypeScript, React, and Node.js code.
Choose your provider:
| Provider | Common primitive APIs |
|---|---|
| Unleash | useFlag("key"), unleash.isEnabled("key") |
| LaunchDarkly | useBoolVariation("key", false), client.variation("key", ...) |
| PostHog | posthog.isFeatureEnabled("key"), useFeatureFlagVariantKey("key") |
| Statsig | client.checkGate("key") |
| OpenFeature | client.getBooleanValue("key", false), useBooleanFlagValue("key", false) |
flag-prune without --write.--write.npx flag-prune --set 'client.isEnabled("old-feature")=true' src
npx flag-prune --set 'client.isEnabled("old-feature")=true' --write src
flag-prune replaces primitive results: booleans, strings, numbers, or null.
The configured call prefix must be static and exact. Later arguments may vary,
so a rule containing only the flag key can match calls that also receive
context or fallback values.
Do not replace a whole call that returns an object, such as a detailed evaluation or variant result. Use a primitive-returning API, or refactor the result to a primitive before pruning it.
Read Flag rules for complete matching details and Getting started for the general CLI workflow.