flag-pruneReplace known feature-flag values and remove the code that can no longer run. Start with a preview, inspect the diff, then write the result.
For AI tools and documentation crawlers, see llms.txt.
| Goal | Page |
|---|---|
| Remove one flag for the first time | Getting started |
| Fit the tool into a full cleanup pipeline | Recommended workflow |
| Remove flags from a specific feature flag SDK | Provider guides |
| Express a hook, client method, imported constant, variant, or member | Flag rules |
| Copy a complete command for a common migration | Recipes |
| Review every command-line option | CLI reference |
| Run in a pull request or CI pipeline | CI and automation |
| Integrate the transform in another tool | Library API |
| Understand what the codemod will and will not remove | Safety guarantees |
| Diagnose a rule that did not match | Troubleshooting |
Every run has three stages:
For example:
const variant = getVariant("checkout")
if (variant === "treatment") {
showNewCheckout()
} else {
showCurrentCheckout()
}
With this rule:
--set 'getVariant("checkout")=treatment'
The result is:
showNewCheckout()
The now-unused variant binding and dead branch are removed as part of the same transform.
flag-prune is one deterministic step in a larger cleanup. A full pass is:
--write.flag-prune command. A completed migration should be a no-op.See Recommended workflow for the full pipeline, an LLM cleanup prompt, and examples.